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, 21.06.2019 13:20
Arectangular room is 4 meters longer than it is wide and its preimeter is 32 meters find the dimensions of the room
Answers: 3
question
Computers and Technology, 22.06.2019 00:40
If you arrive at the same time as another user straight across from you yield if a. they flash your headlights at you b. you can’t see their turn signals c. you’re going street and they’re running d. you’re turning they’re going straight plz
Answers: 1
question
Computers and Technology, 22.06.2019 09:30
What are the steps involved in accepting all the changes in a document? arrange these in order click edit. click accept or reject. click changes. click accept all.
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
You know the right answer?
Class Main { public static void main(String[] args) {

Scanner sc = new Scanner(System....
Questions
question
Mathematics, 14.01.2021 21:30
question
English, 14.01.2021 21:30
question
Computers and Technology, 14.01.2021 21:30
Questions on the website: 13722367