Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Rewrite the Program ( Cable Company Billing ). Expected Program and Design: 1. W

ID: 3771627 • Letter: R

Question

Rewrite the Program ( Cable Company Billing ).

Expected Program and Design:
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
3. Your input will come from a text file of at least 15 customers
3.1 Input file format - customerType accountNumber premiumChannels
       ( i.e residential example: R12345 5 , business example B12345 16 8 )
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 Pay attention to details when you formatting your output

Note: Use all chapter concepts and make your final as a true representation of what we have learned this semester.

Turn in
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 )

Explanation / Answer

#include <iostream>
#include <iomanip>

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;

void main()
{
//Variable Declaration
int accountNumber;
char customerType;
int numOfPremChannels;
int numOf BasicServConn;
double amountDue;

cout << fixed << showpoint;
cout << setprecision(2);

cout << "This program computes a cable bill." << endl;
cout << "Enter account number (an integer): ";
cin >> accountNumber;
cout << endl;

cout << "enter customer type: "
<< "R or r (Residential), "
<< "B or b (Business)";
cin >> customerType;
cout << endl;

if(customerType = 'r' || 'R')
{

cout << "Enter the number of premium channels:";
cin >> numOfPremChannels;
cout << endl;
amountDue = RES_BILL_PROC_FEES
+ RES_BASIC_SERV_COST
+ numOfPremChannels * RES_COST_PREM_CHANNEL;
cout << "Account Number: " << accountNumber;
cout << endl;
cout << "Amount Due: $" << amountDue << endl;

else if(customerType = 'b' || 'B' )
cout << "Enter number of basic service connections: ";
cin >> numOfBasicServConn;
cout << endl;
cout << "Enter number of premium channels: ";
cin >> numOfPremChannels;
cout << endl;

if(numOfBasicServConn <= 10)
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;
cout << "Amount Due: $" << amountDue << endl;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote