Question: Sample run: Enter the width in inches: 1 2 0 Enter the length in inches: 1 8 0 Enter the depth in inches: 4 8

Sample run:
Enter the width in inches: 120
Enter the length in inches: 180
Enter the depth in inches: 48
The pool volume is 600.0 cubic feet.
That makes 4500.0 gallons.
*/
public class PoolVolume {
// Declare and instantiate console as a Scanner (Done for you.)
public static final Scanner console = new Scanner(System.in);
// Declare a named constant for the number of gallons per cubic foot. (Done for you.)
public static final double GALLONSPERCUFOOT =7.5;
public static void main(String[] args){
int widthin;
int lengthin;
int depthin;
double gallons;
int widthft;
int lengthft;
int depthft;
double cubicft; // Declare the variables widthin, lengthin, depthin, gallons,
// widthft, lengthft, depthft, and cubicft
//(Look at the other code for which are int variables and which are double variables.)
// Prompt for and input the width in inches as widthin (Done for you.)
System.out.print("Enter the width in inches: ");
widthin = console.nextInt();
// Prompt for and input the length in inches
System.out.print("Enter the length in inches: ");
lengthin = console.nextInt();
// Prompt for and input the depth in inches
System.out.print("Enter the depth in inches: ");
depthin = console.nextInt();
// For each of width, length and depth, convert it to feet
//(The first is done for you.)
widthft = widthin /12.0;
lengthft = le~ ngthin /18.0;
depthft = depthin /4.8;
// Calculate the number of cubic feet
//Calculate the number of gallons (Done for you.)
gallons = cubicft * GALLONSPERCUFOOT;
//Output the number of cubic feet as "The pool volume is ___ cubic feet."
// and go to the next line. (Output cubicft in the blank.)
//Output the number of gallons as "That makes ___ gallons."
// and go to the next line. (Output gallons in the blank.)
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!