Answer to Question #278719 in C++ for hariz

Question #278719

Calculate a customer's bill for a local cable company. There are two types of customers: residential and customers.

business. There are two rates for calculating a cable bill: one for residential customers and one for business


1
Expert's answer
2021-12-12T12:19:43-0500
#include <iostream>
#include <iomanip>


using namespace std;




const double process = 4.50;
const double service_Cost = 20.50;
const double cost_channel = 7.50;




const double BILL_PROC_FEES = 15.00;
const double BASIC_SERV_COST = 75.00;
const double BASIC_CONN_COST = 5.00;
const double COST_PREM_CHANNEL = 50.00;


int main()
{


int account;
char customer;
int channel_number;
int num;
double amountDue;


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


cout << "This program computes a cable bill." << endl;
cout << "Enter the  account number: ";
cin >> account ;
cout << endl;


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


switch(customer)
{
case 'r':
case 'R':
cout << "Input the number of premium channels:";
cin >> channel_number;
cout << endl;
amountDue = process
+ service_Cost
+ channel_number *
cost_channel;
cout << "Account Number: " << account;
cout << endl;
cout << "Amount Due: $" << amountDue << endl;
break;
case 'b':
case 'B':
cout << "Input the number of basic service connections: ";
cin >> num;
cout << endl;
cout << "Enter number of premium channels: ";
cin >> channel_number;
cout << endl;
if(num <= 10)
amountDue =BILL_PROC_FEES
+ BASIC_SERV_COST
+ channel_number *
COST_PREM_CHANNEL;
else
amountDue = BILL_PROC_FEES
+ BASIC_SERV_COST
+ (num-10) *
BASIC_CONN_COST
+ channel_number *
COST_PREM_CHANNEL;
cout << "Account Number: " << account << endl;
cout << "Amount Due: $" << amountDue << endl;
break;
default:
cout << "Wrong customer type" << endl;


}


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog