Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I have a question in regards to my current Java project assignment. I haven't been able to figure out the math portion of the
Hello! I have a question in regards to my current Java project assignment. I haven't been able to figure out the math portion of the project. My program outputs the correct first set of integers, but does not pass all test when other values are entered. The expected output differs because the new values entered do not compile the expected result. Only thee first test passes.
My Java code is the following:
import java.util.Scanner;
public class PillarConcreteCosts
public static void mainString args
final double prismBase ;
final int CUBICFEETPERCY ;
final double CONCRETECOSTPERCY ;
final double prismHeight ;
Scanner scanner new ScannerSystemin;
System.out.printlnProgram to calculate pillar requirements";
System.out.println;
System.out.printlnBuilding type S M or H;
char buildingType scanner.nextcharAt;
scanner.nextLine;
System.out.printlnCity building is located in;
String cityName scanner.nextLine;
System.out.printlnTwoletter state building is located in;
String stateName scanner.nextLine;
System.out.printlnPillar pentagon side length in feet;
double sideLength scanner.nextDouble;
System.out.printlnNumber of pillars needed?";
int numPillars scanner.nextInt;
System.out.println;
System.out.println;
System.out.printfs
"Pillars for type buildingType building in;
System.out.printfs
cityName;
System.out.printfs
stateName;
System.out.println;
double prismVolume Math.powsideLength Math.tanMathPI prismHeight;
double pyramidVolume Math.sqrtMathpowsideLength;
System.out.printfBase prism volume fn prismVolume,
;
System.out.printfTopper pyramid volume fn pyramidVolume,
;
System.out.printfs
;
double pillarVolume prismVolume pyramidVolume;
System.out.printfOne pillar volume f cubic feetn pillarVolume;
System.out.printfssnx pillars";
double allPillars pillarVolume ;
System.out.printfs
;
System.out.printfVolume all pillars f cubic feetn allPillars;
System.out.println;
double totalConcreteCY Math.ceilallPillars CUBICFEETPERCY;
double totalCost totalConcreteCY CONCRETECOSTPERCY;
System.out.printf cubic yards of concrete required for d pillarsn numPillars;
System.out.printfwith a total cost of $ fn totalCost;
Expectect output:
Program to calculate pillar requirements
Building type S M or H
City building is located in
Twoletter state building is located in
Pillar pentagon side length in feet
Number of pillars needed?
Pillars for type M building in
San Antonio
TX
Base prism volume
Topper pyramid volume
One pillar volume cubic feet
x pillars
Volume all pillars cubic feet
cubic yards of concrete required for pillars
with a total cost of $
I think it's the math portion of my code. Can anyone help? Much appreciated!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started