See this link for Assignment
Policies, Submission Instructions, and Grading Guidelines.
1. Write a Java application that does the following:
2. Use a JOptionPane window to ask the user to enter a number.
3. Use the number to calculate the volume (NOT the area) of three shapes: a sphere, a regular tetrahedron, and a cube.
4. Use the number as the diameter (radius = diameter / 2) of the sphere, as the side of the cube, and as the side of the regular tetrahedron.
5. As much as possible, use the static methods & variables of class Math to do your calculations.
6. Use only one (1) JOptionPane window to output the volume of the three shapes. Use the newline character ("\n") to do this.
7. Formulas: Volume of a cube = s3; Volume of a regular tetrahedron = 1/12 s3 √2; Volume of a sphere = 4/3 π r3 (radius = diameter / 2).
8. Example I/O: If the number is 10, then the results should be cube = 1000, regular tetrahedron = 117.85113019775792073347406035081, sphere = 523.59877559829887307710723054658
9. Don’t forget to use try-catch blocks, so that your program cannot crash.
© 2007 William Albritton