Lab help

/* I am in c++ 101, and I have one problem finishing my lab. It is one of those questions about finishing a customer's monthly bills. My problem is how do you recommend to a customer what their savings would be if they switched their plans.


/*Write a complete C++ program, which will produce the sample runs shown at the
end of this handout.
An internet service provider has three different subscription packages for its
customers.
Package A: For $9.95 per month 10 hours of access are provided. Additional hours
are $2.00 per hour
Package B: For $14.95 per month 20 hours of access are provided. A dditional hours are $1.00 per hour.
Package C: For $19.95 per month unlimited access is provided
Your program calculates a customer’s monthly bill. It should input customer name, which package the customer has purchased, and how many hours were used. It
should then create a bill that includes the input information and total amount due. Also it should display how much money Package A customer would save if they purchased package B or C, and how much money package B customers would save if they purchased package C. If there would be no saving, no message should be
printed.
*/


#include <iostream>
#include <cmath>
using namespace std;

int main () {

char plan;
char name[20];
int hours;

int baseRatePlanA;
int additionalChargePlanA = 0;
int totalAmountPlanA;

int baseRatePlanB;
int additionalChargePlanB = 0;
int totalAmountPlanB;

cout << "Please Enter your name: \n";
cin.getline(name, 20); cout << "Enter your plan: a/b/c \n";
cin >> plan;
cout << "Enter number of hours used \n";
cin >> hours;

switch (plan) {
case 'a':
baseRatePlanA = 9.95;
if (hours>10) {
additionalChargePlanA = (hours-10)*2;
}
totalAmountPlanA = baseRatePlanA + additionalChargePlanA;
cout << "Amount you owe: \n";
cout << totalAmountPlanA << endl;
break;

case 'b':
baseRatePlanB = 14.95;
if (hours>20) {
additionalChargePlanB = (hours-20)*1;
}
totalAmountPlanB = baseRatePlanB + additionalChargePlanB;
cout << "Amount you owe: \n";
cout << totalAmountPlanB << endl;
break;

case 'c':
cout << "Amount you owe: \n";
cout << "25 \n";
break;

default:
break;

}

return 0;
}
Topic archived. No new replies allowed.