mardi 29 septembre 2015

C++ (Can't get this project to compile) [on hold]

So I'm doing this project in class where we have to calculate a customer's monthly bill which fluctuates depending on how many minutes they used and which package they are subscribed to. As of right now, we are supposed to complete it with if/else statements until we learn about switch statements. I've done the majority of the program, but I just can't seem to get the code to compile. Any help is appreciated.

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
  // Variables
    char package;
    const double packageA = 39.99, packageB = 59.99, packageC = 69.99;
    int minutesUsed;
    double overageA, overageB;

    // Displays and asks what package the user is subscribed to
    cout << "The following packages are listed: " << endl;
    cout << endl;
    cout << "Package A: 359.99/month - 450 Minutes - $0.45 per additional      minute" << endl;
    cout << "Package B: $59.99/month - 900 minutes - $0.40 per additional minute" << endl;
    cout << "Package C: $69.99/month - Unlimited Minutes" << endl;
    cout << endl;
    cout << "What package are you subscribed to?" << endl;
    cin >> package;
    cout << "How many minutes were used?" << endl;
    cin >> minutesUsed;
    {
    if (package = 'A')
      {
        if (minutesUsed > 450)
          overageA = packageA + ((minutesUsed - 450)*.45);
        cout << "Your total charge is $" << overageA << endl;

        else
          minutesUsed <= 450;
          cout << "Your total charge is $" << packageA << endl;
      }
    if (package = 'B')
      { 
        if (minutesUsed > 900)
          overageB = packageB + ((minutesUsed - 900)*.40);
       cout << "Your total charge is $" << overageB << endl;

       else
         minutesUsed <= 900;
         cout << "Your total charge is $" << packageB << endl;
      }
    if (package = 'C')
      {
        if minutesUsed >= 1
        cout << "Your total charge is $" << packageC << endl;
      }

          return 0;
    }
}

Aucun commentaire:

Enregistrer un commentaire