Class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System....
![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 22.10.2020 03:01 alexisbreton
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](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
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](/tpl/images/cats/informatica.png)
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](/tpl/images/cats/informatica.png)
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](/tpl/images/cats/informatica.png)
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?
Questions
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 14.01.2021 21:30
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/health.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 14.01.2021 21:30
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/biologiya.png)
Biology, 14.01.2021 21:30
![question](/tpl/images/cats/istoriya.png)
History, 14.01.2021 21:30
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/istoriya.png)
History, 14.01.2021 21:30
![question](/tpl/images/cats/en.png)
English, 14.01.2021 21:30
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 14.01.2021 21:30
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 14.01.2021 21:30
![question](/tpl/images/cats/ekonomika.png)
Business, 14.01.2021 21:30
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 14.01.2021 21:30
![question](/tpl/images/cats/mat.png)
Mathematics, 14.01.2021 21:30