Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code is to be written in Java only Lab4D: Water company (Extra Credit +10pts) Imagine your water company bases their rates on how much

Please code is to be written in Java only

Lab4D: Water company (Extra Credit +10pts) Imagine your water company bases their rates on how much water your household uses. The more water you use, the higher your rate per gallon will be. If your household uses less than 1,000 gallons per month, you will be charged $0.15 per gallon. If your household uses more than 1,000 gallons, the water used beyond 1,000 gallons is charged at $0.25 per gallon up to 2,000 gallons. The water usage that exceeds 2,000 gallons is charged at $0.35. Write a program that prompts the user to input the amount of water used in a month (in gallons) and then calculates their water bill. For example, if the user inputs 1,200 gallons, 200 of those gallons will be at a rate of $0.25 and the remaining 1,000 will be at the rate of $0.15. A sample run is shown below. User input is in bold. Note: The logic can be tricky, but think of how you had to calculate overtime pay in Lab4B. Sample run #1: Gallons of water: 1000 Water bill is: $150.0 Sample run #2: Gallons of water: 1500 Water bill is: $275.0 Sample run #3: Gallons of water: 2750 Water bill is: $662.5

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions