Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE READ We are working on making simple C++ programs using Putty I need help understanding how to do the problem below so that I
PLEASE READ We are working on making simple C++ programs using Putty I need help understanding how to do the problem below so that I can do others like it on my own. We have been working on using switch, break and bool this week PLEASE PAY ATTENTION TO THE TEST CASES PROVIDED the end product MUST look exactly like the test cases shown below, which is what I am having the most trouble with. Thank you in advance! Here is the problem given: You are to write a billing program for Mission Viejo Electric Company. To calculate an electric bill, obtain the following integer values from the user: the month the current meter reading the previous meter reading Calculate an electric bill based on the following rate & consumption table: Kilowatt 0-400 KWH over 400 KWH Consumption Cost a flat rate of $8.50 $8.50 (base rate) + 7.525 cents for each KWH over 400 (May - Sept.) or 6.575 cents for each KWH over 400 (all other months) If the user enters an invalid month, don't ask the user to enter the meter readings. Your program should tell the user that the month was invalid and the program should not continue. If the month is valid, ask for the current and previous readings. The readings cannot be negative numbers. Also the current reading has to be the same or greater than the previous reading. If not, tell the user the readings are invalid and the program should not continue. If the month and readings are ok, calculate the amount due. if(check if the month is bad) Display "invalid month" else //the month is good /what do you do here?? if(the readings are bad) else llthe readings are good display "bad readings" lall is fine. Calculate the amount due. return 0; TEST CASES: Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue. Enter the month: 13 13 is an invalid month Don't ask for meter readings if month is bad. Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue. Enter the month: 5 Enter the current meter reading: 800 Enter the previous meter reading: 1000 The readings are invalid Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue. Enter the month: 10 Enter the current meter reading: 10 Enter the previous meter reading: -1 The readings are invalid Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric b. Please press "ENTER" to continue. Enter the month: 5 Enter the current meter reading: -5 Enter the previous meter reading: -10 The readings are invalid Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue. Enter the month: 5 Enter the current meter reading: 1200 Enter the previous meter reading: 500 You consumed 700 KWH and your amount due is $31.07 If you get $31.08, that is ok. Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bil1. Please press "ENTER" to continue. Enter the month: 5 Enter the current meter reading: 1200 Enter the previous meter reading: 1000 You consumed 200 KWH and your amount due is $8.50 Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue Enter the month: 4 Enter the current meter reading: 1200 Enter the previous meter reading: 500 You consumed 700 KWH and your amount due is $28.23 Enter your first name: Dave Welcome, Dave! This program will ask for the month and current and previous meter readings then calculate your electric bill. Please press "ENTER" to continue Enter the month: 10 Enter the current meter reading: 1200 Enter the previous meter reading: 500 You consumed 700 KWH and your amount due is $28.23
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