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, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Lakendra finished working on her monthly report. in looking it over, she saw that it had large blocks of white space. what steps could lakendra take to reduce the amount of white space?
Answers: 3
You know the right answer?
Class Main { public static void main(String[] args) {

Scanner sc = new Scanner(System....
Questions
question
History, 27.08.2019 19:00
Questions on the website: 13722361