· Lab 1In both part 1 and part 2, use descriptive prompts telling the user what data you want them to enter and in what order. Also place descriptive information which explains what the output number and results refer to. Part 1.Write a complete program to solve the following problem. Prompt the user for the length of the 3 sides of a triangle in ascending order. If a, b, and c r
...[Show More]
· Lab 1
In both part 1 and part 2, use descriptive prompts telling the user what data you want them to enter and in what order. Also place descriptive information which explains what the output number and results refer to.
Part 1.
Write a complete program to solve the following problem.
Prompt the user for the length of the 3 sides of a triangle in ascending order. If a, b, and c represent the 3 sides of a triangle, the last value input will be c, the longest side.
The following calculations will be required:
1. perimeter = a + b + c
2. s = 0.5 times (a + b + c)
3. area = the square root of ( s times (s - a)(s - b)(s - c) )
4. To determine if the triangle is a right triangle ( i.e. has a 90 degree angle) c squared minus the sum of ( a squared plus b squared) will equal 0
Output to the screen the 3 sides..a, b and c, the perimeter, the area, and then output if the triangle is a right triangle or not.
You will need to use the sqrt function, so you will need to include the math libraryRun the program twice using the following data
3.0 4.0 5.05.0 6.0 7.0
COPY YOUR OUTPUT WINDOW FOR BOTH RUNS INTO THE BOTTOM OF YOUR C++ SOURCE FILE(.cpp file)
Part 2.
Write the program described below.
This is a sample which demonstrates Mutually Exclusive Cases
Create a program that determines whether a tropical storm is a hurricane based on its sustained wind speed. If the storm is a hurricane, display the category of the hurricane. If the storm is not a hurricane, display the message that it is not a hurricane.The input will be the wind speed in miles per hour. The output will be the storm classification.
Do NOT use a loop in this program. Run the program twice to test another set of data. Be certain that your program is efficient and that you do not have any unnecessary logical tests in your program.Category Definition
1 Sustained winds of 74 to 95 miles per hour
2 Sustained winds of 96 to 110 miles per hour
3 Sustained winds of 111 to 130 miles per hour
4 Sustained winds of 131 to 155 miles per hour
5 Sustained winds of above 155 miles per hour
[Show Less]