A friend asked me to get someone to look over this but the guy is offline, so I'm asking around here... here's his project:
Project for my intro to programming class, someone wanna read over it and see if they're are any glaring holes?
Code://Travis C Page 226 Problem 23 Internet Provider //October 9th, 2012 // // /* DESIGN BLOCK */ #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; cout << " Travis' Internet Service Provider Subscription\n"; cout << "1. $9.95 per month. 10 hours access. Additional Hours are $2.00\n"; cout << "2. $14.95 per month. 20 hours access. Additional hours are $1.00\n"; cout << "3. $19.95 per month. Unlimited access.\n"; cout << "Please enter the subscription number of your choice: "; cin >> choice; if (choice >=1 && choice <=3) { cout << "How many hours would you access: "; 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 entered a wrong value!"<<endl; cout << "The valid choices are 1 through 3. \n Run the program again."; } cout << "The total for your subcription is:$ "<<total<<endl; } else if (choice !=3) { cout << "The valid choices are 1 through 3. \n Run the program again."; } return 0; } /* Output Travis' Internet Service Provider Subscription 1. $9.95 per month. 10 hours access. Additional Hours are $2.00 2. $14.95 per month. 20 hours access. Additional hours are $1.00 3. $19.95 per month. Unlimited access. Enter your choice: 1 How many hours would you access: 12 The total for your subscription is:$ 13.95 Press any key to continue . . . */


Reply With Quote
Bookmarks