Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Built-Light Pool Company has ask us to provide a program to help their sales

ID: 3764384 • Letter: T

Question

The Built-Light Pool Company has ask us to provide a program to help their sales and construction team determine costs. They build rectangular and circular pools and spas out of a concrete type material. They need a program that gets the length, width, (or radius) and depth from the customer’s requirements based on whether the pool or spa is rectangular or circular. From these requirements, they need the program to provide the surface area of the pool in square feet, the volume of the pool in cubic feet, the cost of labor, and the total cost of the pool. The final request is the program can be run on mobile devices as well as desktop/ laptops. (Don’t prepare the program to run on mobile devices, but it should be graphic in the input and output method.) Figure the rectangle box’s surface area based on five sides. Calculate the circular pool based on a cylinder. (circle area x depth) - volume = pi x radius2 x depth (pi=3.141) - Surface area = 2 pi x radius x depth + 2 pi radius2 Labor is based on 1 man-hour per 10 sq foot at $45.00 per hour Materials cost = $5 per sq foot You may write the program with a rectangle and circle class which you already have or in the program without. Your choice.

Explanation / Answer

// PoolContract.java

import java.util.Scanner;
import java.lang.Math;

// Abstract class for Pool of any shape
abstract class Pool
{
// Surface area and volume are abstract methods
public abstract double surfaceArea();
public abstract double volume();
}
class CircularPool extends Pool
{
// radius and depth are private members
private double radius;
private double depth;
  
// Constructor to initialize private members
public CircularPool(double radius, double depth)
{
this.radius = radius;
this.depth = depth;
}
// method to calculate surface area of Circular pool
public double surfaceArea()
{
return 2*Math.PI*this.radius*this.depth + 2*Math.PI*Math.pow(this.radius,2);
}
// method to calculate volume of circular pool
public double volume()
{
return Math.PI*Math.pow(this.radius,2)*this.depth;
}
}
class RectangularPool extends Pool
{
// length, width and depth are private members
private double length;
private double width;
private double depth;
  
// Constructor to initialize private members
public RectangularPool(double length, double width, double depth)
{
this.length = length;
this.width = width;
this.depth = depth;
}
// method to calculate surface area of Rectangular pool
public double surfaceArea()
{
return 2*(this.length*this.width + this.width*this.depth + this.depth*this.length);
}
// method to calculate volume of Rectangular pool
public double volume()
{
return this.length*this.width*this.depth;
}
}
class PoolContract
{
public static void main(String args[])
{
int choice;
double surface_area = 0.0;
double volume = 0.0;
double labour_cost = 0.0;
double material_cost = 0.0;
double total_cost = 0.0;
double depth = 0.0;
  
// declare variable of type abstract class which can hold object of any type of pool
Pool pool;
// Scanner object to read input from user
Scanner sc = new Scanner(System.in);
// Ask user for type of pool
System.out.println("Menu :");
System.out.println("1. Rectangular pool");
System.out.println("2. Circular pool");
System.out.print("Enter your choice : ");
choice = sc.nextInt();
// To flush out on console
sc.nextLine();
  
switch(choice)
{
case 1:
// Ask user for length, width and depth of pool
System.out.print("Enter length of the pool : ");
double length = sc.nextDouble();
// To flush out on console
sc.nextLine();
System.out.print("Enter width of the pool : ");
double width = sc.nextDouble();
// To flush out on console
sc.nextLine();
System.out.print("Enter depth of the pool : ");
depth = sc.nextDouble();
// To flush out on console
sc.nextLine();
pool = new RectangularPool(length, width, depth);
break;
case 2:
// Ask user for length, width and depth of pool
System.out.print("Enter radius of the pool : ");
double radius = sc.nextDouble();
// To flush out on console
sc.nextLine();
System.out.print("Enter depth of the pool : ");
depth = sc.nextDouble();
// To flush out on console
sc.nextLine();
pool = new CircularPool(radius, depth);
break;
default:
// Print error and exit the program in case of wrong input
System.out.println("Invalid Input.");
return;
}
// Calculate surface area of the pool
surface_area = pool.surfaceArea();
// Calculate volume of the pool
volume = pool.volume();
// calculate labour cost
labour_cost = (surface_area/10)*45;
// calculate material cost
material_cost = surface_area * 5;
// Total cost is labour cost and material cost
total_cost = material_cost + labour_cost;
// Print all the values
System.out.println("Surface area of the pool is "+surface_area);
System.out.println("Volume of the pool is "+volume);
System.out.println("Total cost for the construction of Pool is "+ total_cost);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote