Class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System....
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
Answers: 3
Computers and Technology, 22.06.2019 13:00, ajayfurlow
Which option should u select to ignore all tracked changes in a document
Answers: 1
Computers and Technology, 23.06.2019 07:30, Braxtonw875
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
Mathematics, 13.11.2020 01:00
Mathematics, 13.11.2020 01:00
Mathematics, 13.11.2020 01:00
Mathematics, 13.11.2020 01:00
Mathematics, 13.11.2020 01:00
Chemistry, 13.11.2020 01:00
English, 13.11.2020 01:00