internet service provider.

im not really quite sure, if im doing the problem correctly.. this is what i have so far... i need help please

this is the question to the problem im working on.

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. Additional
hours are $1.00 per hour.
Package C: For $19.95 per month unlimited access is provided.
Write a program that calculates a customer s monthly bill. It should ask which package
the customer has purchased and how many hours were used. It should then display
the total amount due.
Input Validation: Be sure the user only selects package A, B, or C. Also, the number
of hours used in a month cannot exceed 744.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  int Package_A = 1,
            Package_B = 2,
            Package_C = 3,
            choice;
    
    float const CostA = 9.95,
             CostB = 14.95,
             CostC = 19.95;
    
    float hours = 0, cost = 0, FeeA = 2, FeeB = 1;
    
    
    cout << "\t Which service would you like ?\n";
         << " 1. Package A: 10 hours of access";
         << " 2. Package B: 20 hours of access";
         << " 3. Package C: unlimited access";
         cin >> choice;
         
         cout << fixed << showpoint << setprecision (2)<< endl;
         
         switch ( choice)
         {
             case Package_A:     
             
             
             if ( hours > 10)
             {
                 cost+=CostA + FeeA;
                 cout << " there is an additional fee for exceeding 10 hours\n";
                 cout << "your total is : "<< cost << endl;
             }
             else
             {
                  cost+=CostA;            
             cout << "the cost for package A is:  "<< CostA << endl;
             
             }
             break;           
         }
         {
             case Package_B:
                 
                  if ( hours > 20)
             {
                 cost+=CostB + FeeB;
                 cout << " there is an additional fee for exceeding 10 hours\n";
                 cout << "your total is : "<< cost << endl;
             }
             else
             {
                  cost+=CostB;            
             cout << "the cost for package A is:  "<< CostA << endl;
             
             }
         }
    
    
    
Last edited on
I can remember struggling with this one as well. I believe you intended int Package_A = 1, Package_B = 2, Package_C = 3; to be const int Package_A = 1, Package_B = 2, Package_C = 3;
Topic archived. No new replies allowed.