PLEASE HELP!!! I dont know how to do this problem. Every time i try it keeps coming out wrong. PLEASE HELP. Thank you...

An internet service provider has three different subscription package for its customer:

Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 and hour

Package B: For $14.95 per month 20 hours of access are provided. Additional hours arer $1.00 an hour

Package C: For $19.99 per month unlimited access is provided.

write a program that calculates a customer's monthly bill. The program should ask for the package the customer has purchased. It should accept on character, A, B, or C. Any other character should display a message and halt the program. If the user enter A, or B, the program should ask for the number of hours used. The program should dispplay a bill for the customer showing the package, hours and total due.

the program must contains at least one if statement and at least one switch statement.

Instead of just asking us to do your homework for you, post what you have done and find out how to make it work the way you want it to work.

commented: Absolutely! +22

This is what i done so far:

#include <iostream>
using namespace std;

int main()
double hours, charges_A, charges_B, charges_C;

const double A_FIXED_RATE =  9.99;
const double B_FIXED_RATE = 14.95;
const double C_FIXED_RATE = 19.99;

const double A_VARIABLE_RATE = 2.00;
const double B_VARIABLE_RATE = 1.00;

const double A_ALLOWED_HOURS = 10;
const double B_ALLOWED_HOURS = 20;

char choice;

cout<< "Enter A, B, or C: ";
cin>> choice;

cout<< "How many hours: ";
cin>> hours;
charges_C = C_FIXED_RATE;

cout<< "The cost of Package A is: $"<<charges_A<<endl;
if(hours > 10)
cout<< "You pay $2.00 for each extra hour in Package A. \n";

cout<< "The cost of Package B is: $"<<charges_B<<endl;
if(hours > 20)
cout<< "You pay $1.00 for each extra hour in Package B. \n";

cout<<" The cost of Package C is: $"<<charges_B<<endl;

default: cout<< "You did not enter A, B, or C! \n";

return 0;

with the code you are doing, you are creating the variable for every singe package, simply make one value for all calculations and set the rate according to the choice.

//const double rate = blah;
//const double hours = blah;

also, you are printing the output for every single option, put an if statement after the input is entered for your choice to only print out the results for the specified choice:

cin >> choice;

if ( choice == 'A')
    //rate = blah;
    //additional = blah;
    //calculations, etc.
//if choice is b or c etc.

then print one output:

//cout << "the total cost for you package is: " << cost;

that was just a layout for how i would do it(as you can see, most of that wasn't real code, just comments of the layout of the code.) hope this helps :)

Where's your switch statement? You should do something like this:

case 'A':
    if(hours > A_ALLOWED_HOURS)
        // Compute charges
       // Charges is equal to A_FIXED_RATE

case 'B':
     if(hours > B_ALLOWED_HOURS)
        // Compute charges
       // Charges is equal to B_FIXED_RATE
case 'C':
    // Charges equal to C_FIXED_RATE

Then display out your computed charges.