#include <iostream>
using namespace std;
int main()
{
int choice;
double hours;
cout << "Which Subscription package have you purchased? 1, 2, or 3? " << endl;
cin >> choice;
switch (choice)
{
case 1:
cout << "How many hours were used this month? " << endl; //Package A
cin >> hours;
do{
cout << "Please enter a valid number of hours used. " << endl;
cin >> hours;
} while (hours < 0 || hours > 744);
double monthlyBill; //Calculated as base price + additional hours
if (hours >= 11 || hours <= 744)
monthlyBill = 9.95 + (hours * 2.00);
else
monthlyBill = 9.95;
cout << "Your monthly bill is : $";
cout << monthlyBill << endl;
break;
case 2: //Package B
cout << "How many hours were used this month?" << endl;
cin >> hours;
while (hours < 0 || hours > 744); //Input validation
{
cout << "Please enter a valid number of hours used. " << endl;
cin >> hours;
}
double monthlyBill_b; //Calculated as base price + additional hours
if (hours >= 21 || hours <= 744)
monthlyBill_b = 14.95 + (hours * 1.00);
else
monthlyBill_b = 14.95;
cout << "Your monthly bill is: $ ";
cout << monthlyBill_b << endl;
break;
case 3: //Package C is a flat rate of $19.95 per month
cout << "Your monthly bill is $19.95";
break;
default: cout << "You did not enter 1, 2, or 3. ";
break;
}
return 0;
}