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

Write in C++ -Residential- *Bill processing fee: $4.50 *Basic service fee: $20.5

ID: 3642895 • Letter: W

Question

Write in C++

-Residential-
*Bill processing fee: $4.50
*Basic service fee: $20.50
*Premium channels: $7.50 each

-Business-
*Bill processing fee: $15
*Service fee: $75 for first 10, and $5 for each additional
*Premium channels: $50 per channel

1) Identify your constants
2) Your input will come from a text file of at least 15 customers
2.1) Input file format - customerType accountNumber premiumChannels
( i.e residential example: R12345 5 , business example B12345 16 8 )
3) Precision should be two decimal places
4) Calculate the running average for residential and business customer spending
5) Print each customer's bill to a single file and the end of the file should have the average summary for each customer type.
( with header Customer Type and Average Spending )

Explanation / Answer

Solution:

#include <iostream>

#include"stdafx.h"
using namespace std;

int main()
{
int accountNumber; //cutomer's account number
int r, R, b, B;
int numOfPremChannels; //number of premium channels
int numOfBasicServConn; //number of basic connections
char customerType; //customer code
double amountDue; //billing amount
//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 constatns - business cutomers
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;

cout << " Please enter your account number:"<< endl;
cin >> accountNumber;

cout << " Residential or Business:" << endl;
cout << " r for residential, b for business." << endl;
cin >> customerType, r, b;

cout << " Please enter the number of premium channels: " << endl;
cin >> numOfPremChannels;

cout << " Please enter your basic service connection: " << endl;
cin >> numOfBasicServConn;

cout << " --------------------" << endl;
cout << "Your Account number is: " << accountNumber << endl;
cout << " Your service type is :";

if
(numOfBasicServConn <= 10);
{
cout << " Number of Basic Service Connection:"<< endl;
cin >> 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;

if (r)

amountDue = RES_BILL_PROC_FEES +
RES_BASIC_SERV_COST
+ numOfPremChannels *
RES_COST_PREM_CHANNEL;

system("PAUSE");
return 0;
}

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