/*******************************************************************************
* calculate customer's monthly bill
*_______________________________________________________________________________
* calculates bill based on subscription and hours
*_______________________________________________________________________________
*INPUT
* chosen package
* hours of use
*OUTPUT
* cost of bill
*******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
char package;
double hours;
double total;
cout << "enter your billing package selection:\n";
cin >> package;
cout << "A) $9.95/mo - 10 hrs included - $2/hr additional\n";
cout << "B) $14.95/mo - 20 hrs included - $1/hr additional\n";
cout << "C) $19.95/mo - unlimited\n";
cout << " \n";
//input validation
if (package!= 'A' && package != 'a' && package != 'B' && package != 'b' && package != 'C' && package != 'c'){
cout << "please enter a, b, or c.\n";
} else {
cout << "enter number of hours (0-744)\n";
cin >> hours;
}
if (hours <0 || hours>744) {
cout << "invalid hours, please select hours 0-744.\n";
return 1;
}
if (package == 'A' || package == 'a'){
total = 9.95;
if (hours> 10) {
total+= (hours - 10) * 2.00;
}else if (package == 'B' || package == 'b'){
total =14.95;
} if (hours>20) {
total+=(hours-20)*1.00;
}else if (package == 'C' || 'c') { // package c
total =19.95;
}
cout << fixed<<setprecision(2) << "total: $" << total << endl;
}
return 0;
}