Question
Write a program SwissCheese.java that gets from the user 4 values that specify the characteristcs of a rectangular hunk of cheese: width w, length l,
Write a program SwissCheese.java that gets from the user 4 values that specify the characteristcs of a rectangular hunk of cheese: width w, length l, radius r, and height h. The program then computes and displays the volume, of the associated hunk of swiss cheese In developing the program, you should define the following methods:
- cylinderVolume(): computes using its radius and height parameters, the volume of the volume of the associated cylinder. The volume of the cyclinder with radius r and height h is 2.
- barVolume(): computes using its width, height and length parameters, the volume of the associated bar. The volume of the bar is the product of its width, height, and length.
- sphereVolume(): computes using its radius parameter, the volume of the associated sphere. The volume of the associated shere with radius r is 43/3
In addition to these methods you may also create more as you feel necessary. You might want to create methods to get the user input. I dont want to see any class variables or global variables in this program. You may only use local variables.
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