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

Write a class \"Plumbers\" that handles emergency plumbing calls. The company ha

ID: 2246793 • Letter: W

Question

Write a class "Plumbers" that handles emergency plumbing calls. The company handles natural floods and burst pipes. If the customer selects a flood, the program must prompt the user to determine the amount of damage for pricing. Flood charging is based on the numbers of damaged rooms. 1 room costs $300.00, 2 rooms cost $500.00, and 3 or more rooms cost $750.00. Pipe bursting is based on the number of pipes: 1 pipe costs $50.00, 2 pipes cost $70.00, and 3 or more pipes cost $100.00. The Plumber class should contain a nested class to handle billing charges. Use And, Or, and Not in the if statements to obtain the customers' inputs.

Explanation / Answer

Here is your Plumber Class:

Plumber Class:

public class Plumber
{
Scanner input;
billing Bill;

void menu()
{
int n;
input=new Scanner(System.in);
System.out.println("1>Floods 2>Burst pipes Enter Your choice:");
n=input.nextInt();
if(n==1)
FloodCharge();
else if(n==2)   
PipeCharge();
else
{
System.out.println("Please enter valid option");
menu();
}
}
void FloodCharge()
{
Bill=new billing();
int n;
input=new Scanner(System.in);
System.out.println(" Flood charge menu:");
System.out.println("1>For 1 room 2>For 2 room 3>For 3 or more room");
System.out.println("Enter Choice");
n=input.nextInt();
if(n==1)
Bill.BillingService(300,"1 Room");
else if(n==2)
Bill.BillingService(500,"2 Room");
else if(n==3)
Bill.BillingService(750,"3 or more than 3 Room");
}
void PipeCharge()
{
Bill=new billing();
int n;
input=new Scanner(System.in);
System.out.println(" Flood charge menu:");
System.out.println("1>For 1 Pipe 2>For 2 Pipe 3>For 3 or more Pipe");
System.out.println("Enter Choice");
n=input.nextInt();
if(n==1)
Bill.BillingService(50,"1 Pipe");
else if(n==2)
Bill.BillingService(70,"2 Pipe");
else if(n==3)
Bill.BillingService(100,"3 or more than 3 Pipe");
}
  
public static void main(String[] args)
{
Plumber ob=new Plumber();
ob.menu();
}
  
class billing //nested class to handle billing
{
void BillingService(int bill,String type)
{
System.out.println(" Bill");
System.out.println("Type: "+type);
System.out.println("Amount: $"+bill);
}
}
  
}

I hope this solves your problem

Comment if you have any problem in above code

And please give it a thumbs up.

thank you :)

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