//Andres Guzman CSC5 Chapter 4, P. 226, #23
//
/**************************************************************
*
* SELECT INTERNET PACKAGE
* ____________________________________________________________
* This program will allow the user to select an pacakge and then calculate how
* much the user needs to pay.
*
* Computation is based on the formula:
* total = hours + (hours - selected package limit) * select package charges
* ____________________________________________________________
* INPUT
* choice = Allows selections for programmer
* hours = Allows programmer to input desired hours
* OUTPUT
* total1, total2, total3 = Calculates the total according to package
**************************************************************/
#include <iostream>
using namespace std;
int main ()
{
char choice; //Allows for selection
int hours; //Allows desired hours to be inputted
double total1,total2,total3; //Holds calculation of month total
//
//
double packa = 9.95; //First option with additional 2.00 charges per hour
double packb = 14.95; //Second option with additonal 1.00 charges per hour
double packc = 19.95; //Third option with unlimited hours
//
//
cout << "\tInternet Services Packages\n\n";
cout << "Package A" << endl;;
cout << "Package B" << endl;
cout << "Package C" << endl;
cout << "\nWhich Service Package have you purchased? ";
cin >> choice;
if(choice != 'A' && choice != 'B' && choice != 'C')
{ cout << "\nInvalid Package Selected. Please select A, B, or C.";}
else
{
switch(choice)
{
case 'A' : cout << "\nHow many hours were used? ";
cin >> hours;
if (hours < 0 || hours > 744)
{ cout << "\nInvalid, please enter a number between 0 and 744.";}
else if (hours <= 10)
{ cout << "\nMonths Total: " << packa;}
else
{ total1 = packa + (hours - 10) * 2.00; //calculates extra hours
cout << "\nMonths Total: " << total1;
}
break;
case 'B' : cout << "\nHow many hours were used? ";
cin >> hours;
if (hours < 0 || hours > 744)
{ cout << "Invalid, please enter a number between 0 and 744.";}
else if (hours <= 20)
{ cout << "\nMonths Total: " << packb;}
else
{ total2 = packb + (hours - 20) * 1.00; //calculates extra hours
cout << "\nMonths Total: " << total2;
}
break;
case 'C' : cout << "\nUnlimited Hours Provided. ";
cout << "\nMonth Total: " << packc;
break;
}
}
}