Question: Rearrange the following code to have what is specified below it: #include #include using namespace std; //Named constants residential customers const double RES_BILL_PROC_FEES = 4.50;
Rearrange the following code to have what is specified below it:
#include
using namespace std;
//Named constants residential customers const double RES_BILL_PROC_FEES = 4.50; const double RES_BASIC_SERV_COST = 20.50; const double RES_COST_PREM_CHANNEL = 7.50;
//Named constants business customers const double BUS_BILL_PROC_FEES = 15.00; const double BUS_BASIC_SERV_COST = 75.00; const double BUS_BASIC_CONN_COST = 5.00; const double BUS_COST_PREM_CHANNEL = 50.00;
int main() { //Variable declaration int accountNumber; char customerType; int numOfPremChannels; int numOfBasicServConn; double amountDue;
cout << fixed << showpoint; //Step 1 cout << setprecision(2); //Step 1
cout << "This program computes a cable " << "bill." << endl;
cout << "Enter account number (an integer): "; //Step 2 cin >> accountNumber; //Step 3 cout << endl;
cout << "Enter customer type: " << "R or r (Residential), " << "B or b (Business): "; //Step 4 cin >> customerType; //Step 5 cout << endl;
switch (customerType) { case 'r': //Step 6 case 'R': cout << "Enter the number" << " of premium channels: "; //Step 6a cin >> numOfPremChannels; //Step 6b cout << endl;
amountDue = RES_BILL_PROC_FEES //Step 6c + RES_BASIC_SERV_COST + numOfPremChannels * RES_COST_PREM_CHANNEL; cout << "Account number: " << accountNumber << endl; //Step 6d cout << "Amount due: $" << amountDue << endl; //Step 6d break;
case 'b': //Step 7 case 'B': cout << "Enter the number of basic " << "service connections: "; //Step 7a cin >> numOfBasicServConn; //Step 7b cout << endl;
cout << "Enter the number" << " of premium channels: "; //Step 7c cin >> numOfPremChannels; //Step 7d cout << endl;
if (numOfBasicServConn<= 10) //Step 7e amountDue = BUS_BILL_PROC_FEES + BUS_BASIC_SERV_COST + numOfPremChannels * BUS_COST_PREM_CHANNEL; else amountDue = BUS_BILL_PROC_FEES + BUS_BASIC_SERV_COST + (numOfBasicServConn - 10) * BUS_BASIC_CONN_COST + numOfPremChannels * BUS_COST_PREM_CHANNEL;
cout << "Account number: " << accountNumber << endl; //Step 7f cout << "Amount due: $" << amountDue << endl; //Step 7f break;
default: cout << "Invalid customer type." << endl; //Step 8 }//end switch
return 0; }
What needs to be added to the code:
1. Write a pseudo code before starting your program ( you may not use SWITCH, replace it with IF structures ) 1.1 Draw a flowchart for your program based on your pseudo code 2. Identify your constants (no global constants are allowed ) 3. Your input will come from a text file of at least 15 customers ( use input validation of files and values ) 3.1 Input file format - customerType accountNumber premiumChannels ( i.e residential example: R12345 5 , business example B12345 16 8 )
3.11 Add employeeService account type "E" where employees have a processing fee of $4.50 and 20% discount off the residential basic service cost
3.2 Use enumeration type to identify customerTypes
3.3 Use at east 4 functions ( pass parameter by value and by reference) 4. Precision should be two decimal places 5. Calculate the running average for residential and business customer spending 6. Print all customer's bill to a single file and the end of the file you should have the average summary for each customer type.
6.1 Ask the user if he/she also would like to print the bill one customer at a time to the screen. 7. Pay attention to details when you formatting your output
Need: program design ( pseudo code and/or flow chart ) input file output file .cpp file of your program ( make sure you include your header and comment your code )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
