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

Expected Program and Design: 1. Write a pseudo code before starting your program

ID: 3771909 • Letter: E

Question

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

This is what was answerwed. it doesnt work yet, it doesnt pull from a file, or print to a file, please help.

#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 numOfBasicServConn;
   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;

   }

}

Explanation / Answer

#include <iostream>
#include <iomanip>

using namespace std;

classint main()
{
int accountNumber;
char customerType;
int numOfPremChannels;
int numOfBasicServConn;
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;switch (customerType)
{
case 'r':
case'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
<< endl;
cout << "Amount due: $"
<< amountDue
<< endl;
break;case'b':
case'B':
cout << "Enter the number of basic "
<< "service connections: ";
cin >> numOfBasicServConn;
cout << endl;cout << "Enter the 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 << "Acount number: "
<< accountNumber << endl;
cout << "Amount due: $" << amountDue
<< endl;
break;
default:
cout << "Invalid customer type." << endl;
}
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