Monday, October 13, 2014

Internet Service Provider C++

/*
 * isp.cpp
 *
 *  Created on: Sep 24, 2014
 *      Author: Zach
 */

#include "isp.h"
#include <iostream>
using namespace std;

int main ()
{
int choice;
int hours;
double total;

double A = 9.95;
double B = 14.95;
double C = 19.95;
double D = 2.00;
double E = 1.00;

//Display
cout << " \t\What is your package subscription \n";
cout << "1. A.$9.95 per month. 10 hours access. Additional Hours are $2.00\n";
cout << "2. B.$14.95 per month. 20 hours access. Additional hours are $1.00\n";
cout << "3. C.$19.95 per month. Unlimited access.\n";
cout << "Enter your choice: ";
cin >> choice;

if (choice >=1 && choice <=3)
{
cout << "How many hours were used?  ";
cin >> hours;
switch (choice)
{
case 1:
{
total = A + (hours - 10)*D;
break;
}
case 2:
{
total = B + (hours - 20)*E;
break;
}
case 3:
{
total = C;
break;
}

default:
cout<<"You enter a wrong value!"<<endl;
cout << "The valid choices are 1 through 3. \n Run the program again.";
}

cout << "Your charge for this month is: $ "<<total<<endl;
}
else if (choice !=3)
{
cout << "The valid choices are 1 through 3. \n Run the program again.";
}
return 0;
}

No comments:

Post a Comment