import java.util.Scanner; /* Volumes.java ** ** CMPS 134 - Fall 2022 ** Authors: P.M.J. and < STUDENT's NAME > ** Collaborated with: ... ** Known Flaws: ... ** ** Java application that prompts for and reads a series of positive real ** numbers representing measurements for the three-dimensional shapes ** cube, sphere, cylinder, cone, and cuboid. The program then computes ** the corresponding volumes for each shape and reports it as output. */ public class Volumes { // Scanner object through which input data is read from the keyboard. static Scanner keyboard = new Scanner(System.in); // Global input and output variables. static double measurement1; // (input) 1st measurement static double measurement2; // (input) 2nd measurement // CODE MISSING HERE!! static double volume; // (output) holds the computed volume static final double PI = 3.1415926535897932384626433; public static void main(String[] args) { // Prompt user to enter the first measurement. System.out.print("Enter 1st measurement:>"); // Read user's response and store it in the input variable measurement1 = keyboard.nextDouble(); // Call method to compute the volume of a cube. computeForCube(); // Report result for a cube System.out.print("A cube with an edge length of " + measurement1); System.out.println(" has a volume of " + volume); // Call method to compute the volume of a sphere. // CODE MISSING HERE!! // Report result for a sphere System.out.print("A sphere of radius " + measurement1); System.out.println(" has a volume of " + volume); // Now for the second measurement... // Prompt user to enter the second measurement. System.out.println(); System.out.print("Enter 2nd measurement:>"); // Read user's response and store it in the input variable measurement2 = keyboard.nextDouble(); // Call method to compute the volume of a cylinder. // CODE MISSING HERE!! // Report result for a cylinder // CODE MISSING HERE!! // Call method to compute the volume of a cone. // CODE MISSING HERE!! // Report result for a cone // CODE MISSING HERE!! // Now for the third measurement... // Prompt user to enter a third measurement, and read it. // CODE MISSING HERE!! // Compute and report result for a cuboid // CODE MISSING HERE!! } // S t a t i c M e t h o d s // --------------------------- /* Computes the volume of a cube whose edge length is currently in the ** global variable 'measurement1'. */ static void computeForCube() { volume = measurement1 * measurement1 * measurement1; } /* Computes the volume of a sphere whose radius length is currently in ** the global variable 'measurement1'. */ static void computeForSphere() { // CODE MISSING HERE!! } /* Computes the volume of a cylinder whose radius length is currently in ** the global variable 'measurement1' and whose height is currently in the ** global variable 'measurement2'. */ // CODE MISSING HERE!! // CODE (FOR ADDITIONAL METHODS) MISSING HERE! }