I need to modify my program so it also displays money Package A customers would save if they were to purchase packages B or C, and how much money Package B customers would save if they purchased Package C. if no savings, then nothing to be printed.
#include <iostream>
#include <cmath>
#include <iomanip> //header file used because of 'setprecision'
usingnamespace std;
int main ()
{
int choice; // For the choiced the user will choose
int hours; // For hours used per month
double charges; // holding charges
{
//Constants for packages
constdouble
PACKAGE_A = 9.95,
PACKAGE_B = 14.95,
PACKAGE_C = 19.95;
//Constants for menu selection
constint
PACKAGE_A_CHOICE = 1,
PACKAGE_B_CHOICE = 2,
PACKAGE_C_CHOICE = 3,
QUITTING_CHOICE = 4;
//Displaying the menu
cout << "\t\tInternet Service Provider Menu\n\n"
<< "1. Package A\n"
<< "2. Package B\n"
<< "3. Package C\n"
<< "4. Quit this Program\n"
<< "-----------------------\n"
<< "Enter in a choice: ";
cin >> choice;
//this is so the monthly bill is displayed with 2 decimal points
cout << fixed << showpoint << setprecision(2);
//Response to users package selection with if/else if statements
if (choice == PACKAGE_A_CHOICE)
{
cout << "How many hours used on the internet? ";
cin >> hours;
charges = (2.00 * (hours - 10)) + PACKAGE_A; //Math calculating monthly charges
cout << "The total monthly charges are $" << charges << endl;
}
elseif (choice == PACKAGE_B_CHOICE)
{
cout << "How many hours used on the internet? ";
cin >> hours;
charges = (1.00 * (hours - 20)) + PACKAGE_B; //Math calculating monthly charges
cout << "The total monthly charges are $" << charges << endl;
}
elseif (choice == PACKAGE_C_CHOICE)
{
cout << "How many hours used on the internet? ";
cin >> hours;
charges = (0.00 * hours) + PACKAGE_C; //Math calculating monthly charges
cout << "The total monthly charges are $" << charges << endl;
}
elseif (choice == QUITTING_CHOICE)
{
cout << "The Program will now end.\n"; //Displays this if option 4 is selected
}
else
{
cout << "Please select a valid choice 1 through 4.\n"
<<"Run the program again and select one of the valid options.\n";
}
system ("PAUSE");
return 0;
}