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

Please help finish the code. 1.Write a program that calculates and prints the bi

ID: 3667843 • Letter: P

Question

Please help finish the code.

1.Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium.Its rates vary , depending on the type of service. The rates are computed as follows:

Regular service $100.00 plus first 50 minutes are free.Charges for over 50 minutes are $0.20 per minute.

Premium service : $25.00 plus:

A. For calls made from 6:00 am to 6:00pm, the first 75 minutes are free:charges for more than 75 minutes are free : Charges for more than 75 minutes are $0.10 per minute.

B.For calls made from 6:00pm to 6:am, the first 100 minutes are $0.05 per minute.

Program should prompt the user to enter an account number, a sevice code and the number of minutes the service was used.Aservice code of r or R means regular service; a service code of p or P means premium service.Treat any other character as an error.Programm should output the account number, type of service , number of minutes the telephone service was used , and the amount due from the user.

For the premium service,the customer may be using the service during the day and the night.Therefore, to calculate the bill,you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service during the night.

Please complete this code.

#include "stdafx.h"

#include <iostream>

#include <iomanip>

using namespace std;

const double RE_SERV_CHANGES = 10.00;

const int REG_SERV_MINUTES = 50;

const double REG_RATE_OVER50 = 0.20;

const double PREM_SERV-CHARGES = 25.00

const int PREM_FREE_DAY_MINUTES = 75;

const double PREM_DAY_RATE_OVER75 = 0.10;

const int PREM_FREE_NIGHT_MINUTES_OVER_100 =0.05;

int main()

{

int accountNo;

char serviceType;

int minutesUsed;

int minutesUsedPN;

double amountDue;

cout < fixed << showpoint;

cout << setprecision(2);

cout << "Enter account number: " ;

cin >> accountNo;

cout >> end1;

cout << "Enter service type: ( ' r ' or ' R ' ) for regulsr, "

   << " ( p or P) for premium service : " << end1;

cin >> serviceType;

cout << end1;

switch (serviceType)

{

   case ' r ' :

  case ' R ' :

}

  

system("pause");

retuen 0;

Explanation / Answer

Answer - Here is the code. If you need any changes please do reply or comment.

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

const double RE_SERV_CHANGES = 100.00;
const int REG_FREE_SERV_MINUTES = 50;
const double REG_RATE_OVER50 = 0.20;
const double PREM_SERV_CHARGES = 25.00;
const int PREM_FREE_DAY_MINUTES = 75;
const double PREM_DAY_RATE_OVER75 = 0.10;
const double PREM_FREE_NIGHT_MINUTES_OVER_100 =0.05;
const int PREM_FREE_NIGHT_MINUTES =100;

int main()
{
int accountNo;
char serviceType;
int Reg_minutesUsed,P_day_minutesUsed,P_night_minutesUsed;
double amountDue=0;
cout << " Enter account number: " ;
cin >> accountNo;
cout << " Enter service type: ( ' r ' or ' R ' ) for regulsr, ( p or P) for premium service : ";
cin >> serviceType;
do
{
if(serviceType=='r'|serviceType=='R')
{
cout << " Enter Regular service Minutes used: " ;
cin >>Reg_minutesUsed;
if(Reg_minutesUsed<=REG_FREE_SERV_MINUTES)
{
amountDue+=RE_SERV_CHANGES;
}
else
{
amountDue+=RE_SERV_CHANGES+((Reg_minutesUsed-REG_FREE_SERV_MINUTES)*REG_RATE_OVER50);
}
cout<<" Account number: "<<accountNo;
cout<<" Service type(r/R) for Regular,(p/P) for premium service : "<<serviceType;
cout<<" Minutes used :"<<Reg_minutesUsed;
cout<<" Amount Due : "<<fixed<<setprecision(2)<<amountDue;
break;
}
else if(serviceType=='p'|serviceType=='P')
{
cout << " Enter Premium service Minutes used in day: " ;
cin >> P_day_minutesUsed;
cout << " Enter Premium service Minutes used in night: " ;
cin >> P_night_minutesUsed;
if(P_day_minutesUsed<=PREM_FREE_DAY_MINUTES)
{
amountDue+=PREM_SERV_CHARGES;
}
else
{
amountDue+=PREM_SERV_CHARGES+((P_day_minutesUsed-PREM_FREE_DAY_MINUTES)*PREM_DAY_RATE_OVER75);
}
if(P_night_minutesUsed<=100)
{
}
else
{
amountDue+=(P_night_minutesUsed-PREM_FREE_NIGHT_MINUTES)*PREM_FREE_NIGHT_MINUTES_OVER_100;
}
cout<<" Account number: "<<accountNo;
cout<<" Service type(r/R) for Regular,(p/P) for premium service : "<<serviceType;
cout<<" Minutes used during day :"<<P_day_minutesUsed;
cout<<" Minutes used during night :"<<P_night_minutesUsed;
cout<<" Amount Due : "<<fixed<<setprecision(2)<<amountDue;
break;
}
else
{
cout<<" !!!!Please enter Correct Service Type!!!!";
cout << " Enter service type: ( ' r ' or ' R ' ) for regulsr, ( p or P) for premium service : ";
cin >> serviceType;
continue;
}
}while(serviceType!='r'|serviceType!='R'|serviceType!='p'|serviceType!='P');
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