Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Overview. You are to write a simple program for processing an unknown (ahead of time) number of electric bills. This will involve a sentinel-controlled
C++
Overview. You are to write a simple program for processing an unknown (ahead of time) number of electric bills. This will involve a sentinel-controlled while loop based on customer number: a customer number of -1 signals no more customers to process. For each customer, the current and previous meter readings are entered. Then the kilowatt hours (kWh) used and total charge are calculated and a bill displayed. Electricity currently costs $.09 per kWh for the first 600 kWh, then $.11 per kWh for the remaining kWh After all customers are processed, end-of-run statistics are output: the number of customers, total kWh used, and total of all of the electricity bills. That's all there is to it, EXCEPT (you guessed it) there are some functions that have to be included The outline is pretty simple: o Get customer number o While the customer number isn't -1 Get input. Give the user unlimited tries to enter valid current and previous reading values Calculate the bill, output the bill Update counter and accumulators Get next customer number o Output end of run information ALL mainl) does is call functions and keep track of the counter (of customers) and accumulators (of kWh used and electricity bill totals). ALL other processing is done by these functions: int enterCustomerNumber() No menus here. Just request the customer number (or -1 to stop) and return this value to the caller. To keep things simple, assume that all entered customer numbers are "valid bool get Readings [You'll need some parameters here Requests and reads in the current meterreading and previous meter reading from the user. These are ALWAYS whole numbers. Sends these back to the caller via reference parameters. These readings must be 0 or greater, and previous reading must be current reading. This function returns true if the data entered is valid, false otherwise void generateBillo [You'll need some parameters here] Calculates kWh used (current reading-previous reading sent as value parameters) and the charge for kWh used. These are output along with the customer number in a bill looking something like Customer Number 11111 current Reading: 32450 Previous Reading: 30875 Units Used 1575 Month's Charge: 161.25 The kWh used and charge will need to be sent back to the caller via reference parametersStep 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