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

Write a program that prints the monthly bill for one customer of a cellular phon

ID: 3624223 • Letter: W

Question

Write a program that prints the monthly bill for one customer of a cellular phone company. Your program should prompt the user to enter a customer number and the number of minutes of usage for the last month. The customer number should be 11 characters in length and of the format XXX99-9999X, where X represents an alphabetic character and 9 represents a numeric character. The last X in each customer number indicates the type of service, where an R indicates regular service and a P indicates premium service. Your program should ensure that each customer number entered adheres to the required format. When a customer number is entered that is not in the required format, an error message should be generated describing the problem and the program should terminate. When a customer number is entered that is in the required format, the monthly bill for that customer should be generated according to the criteria given below:

Regular Service: The regular service has a base monthly rate of $10.00. The first 50 minutes of usage each month are free, and every minute of usage above 50 minutes is charged at the rate of $0.20 per minute.

Premium Service: The premium service has a base monthly rate of $25.00. For calls made from 6:00 AM to 6:00 PM, the first 75 minutes of usage are free, and every minute of usage above 75 minutes is charged at the rate of $0.10 per minute. For calls made from 6:00 PM to 6:00 AM, the first 100 minutes of usage are free, and every minute of usage above 100 minutes is charged at the rate of $0.05 per minute.

Submit your source code and a script that captures the following activities: compiling your program and executing your program. Also, submit a flowchart that describes the flow of control of your algorithm.

DO ALL MENTIONED ABOVE, WILL RATE WELL. THANKS

Explanation / Answer

#include < iostream >
#include < iomanip >
using namespace std;

const double REG_CHARGES = 10.00;
const int REG_MINUTES = 50;
const double REG_RATE_OVER_50 = 0.20;

const double PREM_SERV_CHARGES = 25.00;

const int PREM_FREE_DAY_MINUTES = 75;

const double PREM_DAY_RATE_OVER_75 = 0.10;

const int PREM_FREE_NIGHT_MINUTES = 100;
const double PREM_NIGHT_RATE_OVER_100 = 0.05;

double regular();

double premium ();

int main(void)
{

      //Variable Declaration
int account;

   char service_type;

   double amount_due=0;
cout << fixed << showpoint;
   cout << setprecision(2);

   cout << "Enter Account Number" << endl;

cin >> account;

   cout << "Enter Service Type: "

      << "R or r (Regular Service), "

       << "P or p (Premium Service): ";
    cin >> service_type;
switch (service_type)
   {
   case 'r':
case 'R':

      amount_due = regular();
      cout << " Account Number = "

           << account << endl;
      cout << "Amount Due = $" << amount_due << endl;
        break;          
case 'p':
   case 'P':

        

       amount_due = premium();

      cout << "Account number = "

           << account << endl;

       cout << "Amount due = $"

            << amount_due << endl;

       break;                 

   default:

      cout << "Invalid customer type." << endl;
}
system("pause");
   return 0;
}
double regular()
{  
        int minutes;
       double bAmount;
        cout << "Enter Number of Minutes" << endl;
       cin >> minutes;
while (minutes<0)
   {
     cout << "Enter Number of Minutes" << endl;
      cin >> minutes;
   }
    if (minutes <= REG_MINUTES)
           bAmount = REG_CHARGES;
        else
          bAmount = REG_CHARGES  

                        + (minutes - REG_MINUTES)  

                          * REG_RATE_OVER_50;
           cout << "Service Type: Regular" << endl;

            cout << "Amount Due: $" << bAmount << endl;
               

             return bAmount;

}

  

double premium()
{

        int day_minutes,night_minutes;

        double bAmount;
          cout << "Enter day time minutes used: ";
       cin >> day_minutes;
        cout << endl;

       cout << "Enter night time minutes used: ";

       cin >> night_minutes;

        cout << endl;

        bAmount = PREM_SERV_CHARGES;

   

         if (day_minutes > PREM_FREE_DAY_MINUTES)

             bAmount = bAmount +  

                         (day_minutes - PREM_FREE_DAY_MINUTES)  

                          * PREM_DAY_RATE_OVER_75;

  

         if (night_minutes > PREM_FREE_NIGHT_MINUTES)

            bAmount = bAmount +  

                       (night_minutes - PREM_FREE_NIGHT_MINUTES)

                         * PREM_NIGHT_RATE_OVER_100;

        cout << "Service Type: Premium" << endl;
        cout << "Minutes Service Used (Day): "
            << day_minutes << endl;
        cout << "Minutes Service Used (Night): "
             << night_minutes << endl;

       return bAmount;

}

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