subject

Class Main { public static void main(String[] args) {

Scanner sc = new Scanner(System. in);

DecimalFormat roundMoney = new DecimalFormat("0.00");

int pyraHeight;

double cost, pyraVolume, baseLength;

System. out. print( "Enter the integer height of the pyramid:");

pyraHeight = sc. nextInt();

System. out. print( "Enter the decimal base length of the pyramid:");

baseLength= sc. nextDouble();

pyraVolume= 1/3 * (Math. pow(baseLength,2)) * pyraHeight;

if(pyraVolume>50){

cost=13 * pyraVolume;

}

else{

cost=18 * pyraVolume;

}

System. out. print( "The volume of the pyramid is "+ pyraVolume);

System. out. println( " cubic inches");

System. out. print( "The cost to make the pyramid is $"+roundMoney. format(cost));

}

}

This is my code and my output for the volume makes no sense at all. It keeps saying 0.0 and that affects the cost as well. Please help me.

Enter the integer height of the pyramid:7
Enter the decimal base length of the pyramid:4.6
The volume of the pyramid is 0.0 cubic inches
The cost to make the pyramid is $0.00

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
To move a file or folder in microsoft windows, you can click and hold down the left mouse button while moving your mouse pointer to the location you want the file or folder to be, which is also known as.
Answers: 3
question
Computers and Technology, 24.06.2019 09:10
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
question
Computers and Technology, 25.06.2019 06:20
In your pest busters game, how does player 2 move the ship 2 object? a pressing the w and s keys b. pressing the up arrow and down arrow keys c. moving the mouse from side to side d. moving the mouse up and down select the best answer from the choices provided
Answers: 1
You know the right answer?
Class Main { public static void main(String[] args) {

Scanner sc = new Scanner(System....
Questions
question
Arts, 05.01.2021 18:30
question
Physics, 05.01.2021 18:30
Questions on the website: 13722360