Question: (JAVA) A class is a group of objects that have similar characteristics and share common methods such as a constructor. The class definition can be
(JAVA) A class is a group of objects that have similar characteristics and share common methods such as a constructor. The class definition can be coded with the calling main or be coded as a separate externally called file (i.e. one file containing the main and another file containing just the class definition itself).
The main will allow the user to: Enter a length, width and depth for a rectangular pool in feet OR diameter and depth for a circular pool. Allow the user to enter decimal values (such as 12.5 or 30.75 feet) Allow the user to select whether to compute for a rectangular pool, a circular pool or Quit. Depending on what type of pool, the capacity constant will be different (i.e. 7.48 gallons per cubic foot for a rectangular vs. 5.9 gallons per cubic foot for a circular pool) Display the dimensions of that pool (i.e. length, width, depth or diameter and depth) that the user entered Return: the volume of the pool in cubic feet the capacity of that pool in the total gallons of water that it can hold the amount of time in hours that the pool needs to be filled to full capacity Run this application as long as the user wishes. Format the output to a maximum of two decimal positions. Add commas to the numerical display
The class will need: A pool constructor Volume calculation (Length X Width X Depth for a rectangular pool or Diameter X Diameter X Depth for a circular pool) Set the number of gallons per cubic foot depending on whether a rectangular or circular pool was selected. 7.48 gallons (a cubic foot contains 7.48 gallons of water) for a rectangular pool and 5.9 gallons for a circular pool (a cubic foot in a circular pool has less gallons). Capacity calculation (Volume X Gallons per cubic foot). The number of hours to fill this pool to full capacity. The water source is a maximum of 50 gallons per minute at full speed. (the formula is Capacity / (number of gallons per hour) ) Number of Gallons per hour = Gallons X 60 minutes
Example output: Your Rectangular Pool is: 24.50 feet in length 30.75 feet across in width 10.25 feet deep
The pool has a volume of 7,722.09 cubic feet The pool has a capacity of 57,761.26 gallons of water The pool has a fill time of 19.25 hours
Your Circular Pool has a: Diameter of 20.00 feet diameter 8.00 feet deep
The pool has a volume of 3,200.00 cubic feet The pool has a capacity of 18,880.00 gallons of water The pool has a fill time of 6.29 hours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
