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.