Question: Write a program in Java or C# or C++. You choose. The program tells you what type of a triangle you have. Write it as

Write a program in Java or C# or C++. You choose. The program tells you what type of a triangle you have.

Write it as follows:

The main program input from a file, and passes three (signed) integers to a function that computes the type of triangle. Besides writing the whole program, your task is to test the function using white box testing techniques.

Have the program prompt for a file name, and read sets of three numbers from the file, reporting on triangle types until the file ends.

You may assume the following:

The file exists

All the inputs are integers. However, they might be negative

The file contains the proper number of entries (a multiple of 3)

The file contains three numbers per line.

Lines that begin with a # are comments, and should simply be echoed.

Results are sent to the standard out. (The function does the output.)

For the function that computes the triangle type, do the following:

Draw a flow graph.

Calculate the cyclomatic complexity, and show how you did it.

Generate a set of test cases from the flow graph.

Turn in the test cases in a file in the above format. The test case file can be used as input to such a program (both yours and mine!) Expected results shall be documented with a comment line before each test case.

Turn in the source code, an executable file, the flow graph and cyclomatic complexity, a short description of how to generate the test cases from the flow graph, and the test case file.

Here is the input file

A5_Input.txt

# Scalene 4 2 3 # Isocoles 9 8 8 # Isocoles 14 14 21 # Isocoles 11 2 11 # Equalateral 199 199 199 # Not a tirangle 1. 0 4 # Not a tirangle 2. 2 0 # Not a tirangle 0 0 0 # Not a tirangle 5 -1 2 # Not a tirangle 5 6 11 # Not a tirangle 5 7 14 # Not a tirangle 4 23 19 # Not a tirangle 4 23 18 # Not a tirangle 5 1 4 # Not a tirangle 5 2 2

Score for Assignment 5:

Item

Possible Points

Points received

Flow graph: complete and shows logic

10

Flow graph: one entry, one exit

4

Flow graph: one condition per bubble

4

Cyclomatic complexity: calculated and correct

5

Basis path set: complete and correct

7

Test cases: complete

5

Test cases: generated from basis path set

5

Program is correct

10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!