Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This code is in Java. This program is for a swimming pool filling service company. They charge 2 cents per gallon and $50 per hour

This code is in Java.

This program is for a swimming pool filling service company. They charge 2 cents per gallon and $50 per hour to fill a pool. The truck can fill at a rate of 730 gallons per hour.

Create the Pool class that calculates the cost to fill a pool based on it's Shape, length, width and depth.(Input order is S L W D) The pool class will need data fields for String shape, double length, double width, double depth, static double GallonsPerCuFoot = 7.4805, static double price per gallon = .02, static double FillingFeePerHour = 50.0, and static double FillingRate = 730gal/hr. Create a No-Arg constructor and a constructor that accepts the non-static values, and has the methods: getShape, getLength, getWidth, getDepth, getCubicFt, getGallons, getHours, and getTotalCost. At the end of the class, create a main() method that asks for the input and returns the output based on the Pool class gets.. methods. The shape options are oblong or rectangle. (A round pool would be oblong with the same width and height, a square pool would have the same width and height) Formulas: Rectangle cubic ft = length * width * depth. Oblong cubic ft= ((Math.PI * Math.pow(width/2,2)* depth) +((length-width) * width * depth)) Gallons = cubic ft * 7.4805. hours = total gallons/730. Total cost = (total Gallons * .02)+(hours * $50) Example Output An oblong pool 18.00 feet long by 12.00 feet wide and 5.00 feet deep will use 6923.10 gallons of water and take 9.48 hours to fill. The total cost will be 612.65.

import java.util.*; /* * Your Header info here!! */

public class Pool {

// put the code here

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions

Question

Describe the appropriate use of supplementary parts of a letter.

Answered: 1 week ago