Question
Hello Chegg I'm taking Intro to Java programing, and I need some help setting up the below code. Thanks for any assistance you can give
Hello Chegg I'm taking Intro to Java programing, and I need some help setting up the below code. Thanks for any assistance you can give me.
Write a program that asks for the customers last and current meter reading in Kilowatt Hours (KwHs). Determine the amount of usage for the month and calculate a sub total (before tax) and a total amount due (tax included) using the following constraints.
Constraints
Rate A: For 500 KwHs or less = $0.0809 / KwH
Rate B: For 501 to 900 KwHs = $0.091 / KwH
Rate C: For greater than 900 KwHs = $0.109 / KwH
Utilities Tax is 3.46% regardless of usage.
Requirements
Use a method to determine the usage
Use a second method to determine the tax
Use a third method to determine the subtotal
Format all output as follows:
o Usage to 1 decimal place, KhWs o Rate to 4 decimal places, monetary
o Subtotal to 2 decimal places, monetary o Taxes to 2 decimal places, monetary
o Total to 2 decimal places, monetary
Implement a loop to return and enter new values (run the program again) if the user wishes to Hints
The type of loop can be of your choosing
Make sure you use Java coding conventions
Expected Output
Below is a sample run with three iterations. User input in BOLD
Welcome to the City Power Bill Calculator! Please enter your previous meter reading: 750
Please enter your current meter reading: 1250
Your usage was: 500.0 KwHs
Your rate was: $0.0809/KwH
Your subtotal is: $40.45
Taxes are: $1.40
Your total bill this month is: $41.85
Would you like to calculate a new usage?
(Y for Yes, N to exit): y
Please enter your previous meter reading: 750
Please enter your current meter reading: 1350.63
Your usage was: 600.6 KwHs
Your rate was: $0.0910/KwH
Your subtotal is: $54.66
Taxes are: $1.89
Your total bill this month is: $56.55
Would you like to calculate a new usage?
(Y for Yes, N to exit): y
Please enter your previous meter reading: 750.39
Please enter your current meter reading: 1655.37
Your usage was: 905.0 KwHs
Your rate was: $0.1090/KwH
Your subtotal is: $98.64
Taxes are: $3.41
Your total bill this month is: $102.06
Would you like to calculate a new usage?
(Y for Yes, N to exit): n
Thank you for using this program. Goodbye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started