Solved–Programming Assignment#3 Circle, Sphere, and Cylinder– Solution

$35.00 $24.00

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…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)
  1. Write an application named MyShapes3 that reads a radius to calculate circle, sphere, and cylinder measurements.
  2. The application should have the following static methods:
    1. main
    2. readData
    3. calculations
    4. printOutput
    5. printHeader
    6. printFooter

 

  1. 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.
  2. 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.
  3. Use the following formulas to do the calculations:
    1. Circle:
      1. Area = πr2.
      2. Circumference = 2πr.
    2. Sphere:
      1. Volume = 4/3 πr3. (pay attention when you divide integer by integer).
      2. Surface Area = 4 πr2.
    3. Cylinder:
      1. Volume = πr2h.
      2. Surface Area = 2πrh.

Note: You may use Math class methods.

  1. Display your output with appropriate labels, indentions, and alignments.
  2. Make sure you document your class and code.
  3. Attach (do not turn in any hardcopy) via BlazeView the following items:
    1. 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:
      1. Have you used static variables and six methods?_____________?
      2. Does your program compile without syntax errors: ___________?
      3. Does your program run without runtime errors: ___________?
      4. Does your program run without logical errors: ___________?
      5. Does your program satisfy the assignment requirements: ________?
      6. Have you documented the program: _____?
      7. Have you documented the methods: _______?
      8. Have you used good variable names:_______”
      9. Is your program well structured, aligned, indented, and easy to read: _____?

 

    1. Name the class that contains the main method (MyShapes3).
    2. Zip all your files into single one. Name it with your last name followed by the program#. For example, Fares3.

 

  1. 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 **************************