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

Part H Problem ees homeowners one of the rates below, eiven the cubic feet of wa

ID: 3739722 • Letter: P

Question

Part H Problem ees homeowners one of the rates below, eiven the cubic feet of wate A flat rate of $15.00 for usage up to and including 1000 cubic feet . So.0175 per cubic foot for usage over 1000 cubic feet and up to and including 2000 cubic feet. . $o.02 per cubic foot for usage over 2000 cubic feet and up to and including 3000 cubic feet .A flat rate of $70.00 for usage over 3000 cubic feet. The water tax rate applied by the company is 1.15%. The final water bill should include the tax. To do: 1. Develop a solution (analysis and flowchart) to compute and display the water bill. 2. Write a program to implement the solution developed in (1) above. Your program will prompt the user to enter water usage (in cubic feet) then compute and display the bill (in dollar). Use Eclipse to create a new Java Project called Exam2. Then create the following two classes WaterBill and WaterBillTester. tyour program with the following: INPUT Water usage EXPECTED RESULT Water bil 750 1250 2000 2500 3500 $15.17 $19.60 $32.87 $42.99 $70.81

Explanation / Answer


Solution for computing Water Bill for given Water Usage:
---------------------------------------------------------
Analysis:
--------
Given criteria :
1. waterusage<=1000 : 15 dollars.
2. waterusage > 1000 and waterusage <= 2000 : 0.0175 dollar per cubic feet
3. waterusage > 2000 and waterusage <= 3000 : 0.02 dollar per cubic feet
4. waterusage > 3000 : 70 dollars

computation :

Take an input and compute for each of the conditions above by

1. for waterusage less than 1000 water blll=15 dollars

2. for waterusage > 1000 and waterusage <= 2000

waterBill=(waterUsage-1000)*0.0175+15;

here we are calculating separately for part above 1000 and for <= 1000

3. for waterusage > 2000 and waterusage <= 3000
waterBill=(waterUsage-2000)*0.02+1000*0.0175+15;
here we are calculating separately for part above 2000 and for 1000-2000 and for <= 1000
4. for waterusage grater than 3000 water blll=70 dollars
calculate tax on computed water bill
tax=(waterBill*1.15)/100;
finally add tax to computed water bill
waterbill = computed water bill + tax;


flowchart :
---------
input waterusage ---> categorize water usage into 4 categories ---> Apply conditions and compute for each component
--------->Add each component to get water bill ---> Compute Tax for water bill --> Add Tax to water bill --> Output generated water bill

WaterBillTester.java
---------------------------
import java.util.*;
public class WaterBillTester {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner=new Scanner(System.in);
System.out.println("Ënter Water Usage in cubic feet");
//Take water usage as input in cubic feet
int waterUsage=scanner.nextInt();
//create an instance of water bill
WaterBill waterbill=new WaterBill();
// call the function of waterbill class passing waterUsage as an input
double waterBill=waterbill.computeWaterBill(waterUsage);
System.out.println("WaterUsage : "+waterUsage+" "+"WaterBill : "+waterBill+"$");
}
}

WaterBill.java
------------------
public class WaterBill {
//This function calculates the water bill and returns it to main function
public double computeWaterBill(int waterUsage) {
double waterBill=0;
// tax to be levied on computed water bill in percentage
double taxPercent=1.15;
// apply the condition for >3000 (flat 70$)
if(waterUsage>3000)
waterBill=70;
// for value 2000>waterUsage<=3000 compute separately for each category and add it
else if (waterUsage > 2000 && waterUsage<=3000)
{
waterBill=(waterUsage-2000)*0.02+1000*0.0175+15;
}
//for value 1000>waterUsage<=2000 compute separately for each category and add it
else if(waterUsage>1000 && waterUsage<=2000) {
waterBill=(waterUsage-1000)*0.0175+15;
}
// apply the condition for <=1000 (flat 15$)
else {
waterBill=15;
}
//compute tax and add it to water bill
waterBill=(waterBill*1.15)/100 + waterBill;
return waterBill;
}
}
Run WaterBillTester.java to get output

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