Starting from:
$35

$29

Programming Assignment Chapter 9 Solution

1. Write an interactive menu driven program that allows the user to obtain specified measurements of several geometric figures. A loop will be used to allow the user to continue to request computations as long as he/she wants and stops when the user wants to stop.

2. The program should computer the following:

1. The area of a square: AREA = SIDE X SIDE

2. The area of a rectangle: AREA = LENGTH X WIDTH

3. The hypotenuse of a right triangle: HYPOTENUSE = SQRT ( SIDE1 X SIDE 1 + SIDE2 X SIDE 2)

4. The area of a right triangle: AREA = SIDE1 X SIDE 2 / 2

5. The area of an isosceles triangle: AREA = HEIGHT X BASE / 2

6. The circumference of a circle: CIRCUMFERENCE = 2 X RADIUS X Pi

7. The area of a circle: RADIUS X RADIUS X Pi

8. The volume of a sphere: VOLUME = 4 X PI X RADIUS X RADIUS X RADIUS / 3

3. Each of the computations above must be performed in separate value returning functions. They will be called when needed to provide the user with the requested information. These functions will not contain any input or output statements.

4. All numeric values used in this program should be of type double . Output all answers using 2 decimal positions. Use 3.1416 for Pi.

5. Use the following data to test your program. Test all 8 options.

1. Side = 10.5

2. Length = 15.5 Width = 20.5

3. Side1 = 30.5 Side2 = 35.5

4. Side1 = 40.5 Side2 = 45.5

5. Height = 50.5 Base = 55.5

6. Radius = 60.5

7. Radius = 65.5

8. Radius = 5.5

6. Display the answers on the screen. Also write the answers to a file. Do not write the menu to the output file. Print the file and turn it in with your program.

7. Turn in:

- a printed copy of your program

- a USB device containing your program

- a program structure chart of your program

- a printed copy of your output file

More products