98 583
Assignments Done
98.9%
Successfully Done
In April 2021

# Answer to Question #48405 in C++ for alvin kassab

Question #48405
When outputting the number of minutes the telephone service was used, output the day time and night time minutes used for a Premium type of service.
Be sure to format your output appropriately (e.g. use dollar signs and round cents to 2 decimal places).
TIP: Utilize a switch to implement your solution.
Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:

Regular service: $10.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 a.m. to 6:00 p.m., the first 75 minutes are free; charges for more than 75 minutes are$0.10 per minute.
b. For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free; charges more than 100 minutes are $0.05 per minute. 1 Expert's answer 2014-10-31T13:11:18-0400 #include <stdlib.h> #include <iostream> #include <stdio.h> #include <cstdlib> using namespace std; class Money { private: int dollars; int cent; public: Money(int dol, int cen) { dollars = dol; cent = cen; } void AddDollars(int _dollars) {dollars += _dollars;} void AddCents(int _cent) { cent += _cent; while(cent > 99) { cent -= 100; ++dollars; } } void DisplayMoney() { cout<<"$"<<dollars<<"."<<cent;
}
};
int main()
{
Money money(0, 0);
int service;
cout<<"what service do you use?"<<endl;
cout<<"1.Regular service"<<endl;
cin>>service;
switch(service)
{
case 1:
{
int minutes = 0;
cout<<"Enter the number of minutes: ";
cin>>minutes;
if (minutes > 50)
{
minutes -= 50;
}
cout<<"bill payment services is ";
money.DisplayMoney();
cout<<endl;
} break;
case 2:
{
int minutes1;
int minutes2;
cout<<"Enter the number of minutes (from 6:00 a.m. to 6:00 p.m): ";
cin>>minutes1;
cout<<"Enter the number of minutes (from 6:00 p.m. to 6:00 a.m): ";
cin>>minutes2;
if (minutes1 > 75)
{
minutes1 -= 75;
}
if (minutes2 > 100)
{
minutes2 -= 100;
}

cout<<"bill payment services is ";
money.DisplayMoney();
cout<<endl;
}; break;
default: cout<<"Error. Wrong input!!!"<<endl;
}
system("pause");
return 0;
}

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!