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 06:30
What result from the passage of this amendment
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
When is it appropriate to use an absolute reference
Answers: 1
question
Computers and Technology, 22.06.2019 18:10
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
Append and make table queries are called queries. select complex simple action i think action
Answers: 1
You know the right answer?
Class Main { public static void main(String[] args) {

Scanner sc = new Scanner(System....
Questions
question
Mathematics, 01.02.2021 21:40
Questions on the website: 13722361