An ISP has 3 different subscription packages a) $19.95 per month, 5 hours access
ID: 654560 • Letter: A
Question
An ISP has 3 different subscription packages
a) $19.95 per month, 5 hours access. Additional hours are $0.75 up to 20 hours then $1 for all additional hours.
b) $24.95 per month, 15 hours access. Additional hours are $0.75 up to 25 hours then $0.50 for each hour above this limit.
c) $29.75 per month unlimited access Write a program that calculates a customers monthly bill. Ask which package, and how many hours then display the monthly charge. Also, output when customers should transition to another package to save money.
Please help me with the last part to output when customers should transition to another package to save money.
Explanation / Answer
#include <iostream.h>
using namespace std;
int main()
{
int ch, hours;
bool flag = true;
double bill = 0;
cout << "1. Package A 2. Package B 3. Package C" << endl;
cout << "Enter your package : ";
cin >> ch;
cout << "Enter the number of hours : " ;
cin >> hours;
switch(ch)
{
case 1 :
bill = 19.95;
if(hours > 5 && hours <= 20)
{
bill += 0.75 * hours;
}
if(hours > 20)
{
bill += 1 * hours;
}
break;
case 2 :
bill = 24.95;
if(hours > 15 && hours <= 25)
{
bill += 0.75 * hours;
}
if(hours > 20)
{
bill += 0.50 * hours;
}
break;
case 3 :
bill = 29.75;
break;
default :
cout << "Invalid choice.";
}
if(flag)
{
cout << "Monthly bill is : $" << bill << endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.