//George Molinero csc5 chapter 4, P. 226, #23
//
/*******************************************************************************
*
* Compute Internet Bill
* _____________________________________________________________________________
* This program computes the total of an intertnet Bill
* _____________________________________________________________________________
* INPUT
* Package : Package selected
* hours : Amount of hours used
*
* OUTPUT
* ExtraHours : Amount of hours past limit
* Total Bill Amount Displayed
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
const float PackA = 9.95;
const float PackB = 14.95;
const float PackC = 19.95;
char Package;
int hours;
int ExtraHours = 0;
cout << "What package have you purchased? " << endl;
cin >> Package;
if(Package == 'A' || Package == 'a' || Package == 'B' || Package == 'b' ||
Package == 'c' || Package == 'C')
{
switch (Package)
{
case 'A':
case 'a': cout << "How many hours were used? " << endl;;
cin >> hours;
if (hours <= 744)
{
if (hours > 10)
{
ExtraHours = hours - 10.0;
cout << "Your total is $" << (ExtraHours * 2.00)
+ (10 * PackA);
}
else
cout << "Your total is $" << hours * PackA;
}
break;
case 'B':
case 'b': cout << "How many hours were used? ";
cin >> hours;
if (hours <= 744)
{
if (hours > 10)
{
ExtraHours = hours - 10.0;
cout << "Your total is $" << (ExtraHours * 1.00)
+ (10 * PackB);
}
else
cout << "Your total is $" << hours * PackB;
}
break;
case 'C':
case 'c': cout << "How many hours were used? ";
cin >> hours;
if (hours <= 744)
cout << "Your total is $" << hours * PackC;
break;
}
}
return 0;
}