Question
Create a new BlueJ project called Project1 and inside that create a class called ConeCalculator . Add a static method called coneCalc , which will
Create a new BlueJ project called Project1 and inside that create a class called ConeCalculator. Add a static method called coneCalc, which will contain all code for this program.
Use the formulas below to calculate the values needed. However, use meaningful variables names in your program, not the abbreviated symbols shown in the formulas.
For a cone with radius r and height h, the slant height (s) is the length along the edge from the tip of the cone to the base:
*look at image*
As with almost all programs: work on it in stages. Don't try to get the whole thing written before compiling and testing it. For example, you could:
- Get the infrastructure of the program set up, printing just the intro line and the first prompt. Compile and run the program.
- Set up the Scanner object for reading input. Read the input values and print it back out temporarily. Compile and test.
- Check to see if the input values are invalid and print the error message if so. Test some invalid values.
- If the input is valid, compute the lateral surface area and print it out. Test with the values used in the sample output above. Don't do the calculations if the input is invalid!
- Compute the other values and print them out. Test.
- Test the program with multiple other input values, verifying the output with hand calculations.
For a cone with radius r and height h, the slant height (s) is the length along the edge from the tip of the cone to the base: The slant height can be calculated as follows: Then the lateral surface area (LSA) and total surface area (TSA) are calculated as follows: TSA = . r . (r + s) The volume of the cone (V) is calculated using this formula: 2
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