$29
Write an application named MyShapes3 that reads a radius to calculate circle, sphere, and cylinder measurements.
The application should have the following static methods:
main
readData
calculations
printOutput
printHeader
printFooter
One way to access variables in several methods is to declare the variables outside the methods (inside the class). Since we are using static methods, we need to declare these variables and constants (if any) as static too.
Prompt user to enter the radius (circle, sphere, and cylinder) and height (cylinder) from keyboard in readData method. Both radius and height are of type integer.
Use the following formulas to do the calculations:
Circle:
Area = πr2.
Circumference = 2πr.
Sphere:
Volume = 4/3 πr3. (pay attention when you divide integer by integer).
Surface Area = 4 πr2.
Cylinder:
Volume = πr2h.
Surface Area = 2πrh.
Note: You may use Math class methods.
Display your output with appropriate labels, indentions, and alignments.
Make sure you document your class and code.
Attach (do not turn in any hardcopy) via BlazeView the following items:
A single typed page with your name, class, date, and program title. The report (named MyReport3) should include what you learned from the programming assignment, problems faced, skills learned, and your observations. Also, append to your report the following fill in self-evaluation:
Have you used static variables and six methods?_____________?
Does your program compile without syntax errors: ___________?
Does your program run without runtime errors: ___________?
Does your program run without logical errors: ___________?
Does your program satisfy the assignment requirements: ________?
Have you documented the program: _____?
Have you documented the methods: _______?
Have you used good variable names:_______”
Is your program well structured, aligned, indented, and easy to read: _____?
Name the class that contains the main method (MyShapes3).
Zip all your files into single one. Name it with your last name followed by the program#. For example, Fares3.
Sample output
Enter radius (integer): 1
Enter cylinder height (integer): 10
************************ Shapes Report *******************
Name: John Smith
Course: CS1301?
Date: Mon Aug 24 10:59:45 EDT 2015
**********************************************************
Input values:
Radius: 1
Height: 10
Circle Measurements:
Circle Area: 3.14
Circle Circumference: 6.28
Sphere Measurements:
Sphere Volume: 4.19
Sphere Surface Area: 12.57
Cylinder Measurements:
Cylinder Volume: 31.42
Cylinder Surface Area: 62.83
****************Have a good day **************************