CMPS 134 Fall 2022
Prog. Assg. #2: Volumes
Due: 11:59:59pm, Friday, Sept. 23
Hard Deadline: Noon, Sunday, Sept. 25

Requirements

For this assignment you are to complete the development of the Java program Volumes so that it behaves as illustrated in the example user/program dialog below. (Input supplied by the user is shown in blue.)

Enter 1st measurement:>1.0
A cube with an edge length of 1.0 has a volume of 1.0
A sphere of radius 1.0 has a volume of 4.1887902047863905

Enter 2nd measurement:>2.0
A cylinder of radius 1.0 and height of 2.0 has a volume of 6.283185307179586
A cone of radius 1.0 and height of 2.0 has a volume of 2.0943951023931953

Enter 3rd measurement:>3.0
A cuboid of edge lengths 1.0, 2.0 and 3.0 has a volume of 6.0

Observe that the program prompts the user to enter three "measurements". In response to each prompt, the user is expected to enter a positive real number. These numbers are interpreted to describe the sizes of various three dimensional figures. The program computes and prints the respective volumes of those figures. To be more specific:

The source program file, as given to you, is incomplete. It is a valid Java program, but it does not fully perform its intended task. Indeed, its behavior is as follows:

Enter 1st measurement:>1.0
A cube with an edge length of 1.0 has a volume of 1.0
A sphere of radius 1.0 has a volume of 1.0

Enter 2nd measurement:>2.0

It is your job to complete the program so that it does the intended task fully. Comments present in the program serve as a guide.

It is up to you obtain the formulae for these volume computations from a reliable source —such as a mathematics textbook or an online resource— and to translate them into legal Java arithmetic expressions.

Also in need of completion is the comment block at the top of the file, where you are to include your name, the names of people who aided you or with whom you collaborated, and a description of any "defects/flaws", meaning incorrect behavior exhibited by the program.

Submission of Program

After completing the source program, which must be in a file named Volumes.java, submit it to the appropriate folder (named something like Prog. Assg. #2) using the Student File Submission/Retrieval Utility, a link to which appears on the CMPS 134 course web page. There is no point in submitting the corresponding ".class" file. If, after submitting your source code file, you make improvements or corrections to it, you can submit it again (and again, etc.). Normally, only the last version of the file that you submit will be graded.