Cmis 102 Week 3

Submitted by: Submitted by

Views: 10

Words: 1015

Pages: 5

Category: Science and Technology

Date Submitted: 12/01/2015 10:10 PM

Report This Essay

Luiso, Joseph Ponzi

CMIS 102

Mr. Specioso, Richard

31 OCT 2015

// Week 3

Overview:

This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design (using both flow chart and pseudocode visualization), and implementation with C code. The example provided uses sequential and selection statements.

Program Description:

This program will calculate the area of a right triangle. The program will ask the user to enter the base and height and then use these values to calculate and then print the area of the triangle. If the area of the triangle is greater than 100 square units, an additional message is printed stating the triangle is too large for the specification. However; if the triangle is less than or equal to 100 square units, the additional message will state the triangle is within specifications. The design step will include both pseudocode and flow chart visualization.

Analysis:

I will use sequential and selection programming statements.

I will define two float numbers for the base and height: base, height.

Float numbers were selected as opposed to integers to make sure triangles of all dimensions are possible and not just whole numbers.

Float number will store the area: area

The area will be calculated by this formula:

Area = ½ * (base * height)

For example if the base was 4.2 and the height was 5.3 the area would be calculated as:

Area = ½ * (4.2 * 5.3) = ½ * (22.26) = 11.13

The additional selection statement will be of this form:

If area > 100 then

print "Triangle is not within specifications"

Else

print "Triangle is within specifications"

End If

Test Plan:

To verify this program is working properly the following base and height values could be used for testing:

Test Case

Input

Expected Output

1

Base=10.1 Height = 12.2

Area = 61.61

Triangle is within specifications.

2

Base=2.67...