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:
Enter the length in inches:
Enter the depth in inches:
The pool volume is cubic feet.
That makes gallons.
public class PoolVolume
Declare and instantiate console as a Scanner Done for you.
public static final Scanner console new ScannerSystemin;
Declare a named constant for the number of gallons per cubic foot. Done for you.
public static final double GALLONSPERCUFOOT ;
public static void mainString 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.printEnter the width in inches: ;
widthin console.nextInt;
Prompt for and input the length in inches
System.out.printEnter the length in inches: ;
lengthin console.nextInt;
Prompt for and input the depth in inches
System.out.printEnter 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 ;
lengthft le~ ngthin ;
depthft depthin ;
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
