Write a complete 3 File C program named cscd255_w13_hw3.c, cscd255_w13_hw3.h, an
ID: 441210 • Letter: W
Question
Write a complete 3 File C program named cscd255_w13_hw3.c, cscd255_w13_hw3.h, and cscd255_w13_hw3functions.c that Asks the user for a radius of a circle. The radius will be read in as a double You must verify the radius is greater than 0.0. Display a menu that allows To enter a new radius Calculate the following: The circumference of the circle The area of the circle The surface area of the sphere with that radius The volume of the sphere with that radius. Quit Once you have the above, print the results out to the screen. For the circle the results need to be formatted to 3 decimal places. For the sphere the results need to be formatted to 4 decimal places. * Don't worry about making them in three files. * This is the main file: #include #include #include const double PI = M_PI; int main() { int choice; double radius, area, surfaceArea, circumference, volume; radius = readRadius(); do { choice = menu(); if(choice == 1) radius = readRadius(); else if(choice == 2) { circumference = calcCirc(radius); area = calcArea(circumference); surfaceArea = calcSurfaceArea(area); volume = calcVolume(area, radius); printResults(radius, circumference, area, surfaceArea, volume); } else printGoodBye(); }while(choice != 3); return 0; }// end mainExplanation / Answer
You have to use switch cases for displaying various options to choose from. To accept the radius from the user, use the double data type. Calculate the various things required and display it to the user in the different case statement of the switch - case. Cheers! Please rate :)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.