samedi 6 octobre 2018

Change Value of Variable in If Statements C++

I'm trying to change the value of my variable rate in an if statement nested in a switch.

I keep getting an error of expected expression but dont understand.

My first if statement is fine. It is the else if statements i'm having trouble with.

This code is just the portion that i'm having trouble with.

    case 'd':
    case 'D':

        if (Income <= 10000)
            rate = .10;
            cout << "Your Tax rate is 10%";

        else if(Income>=10001;Income<=37450)
            rate = .15;
            cout << "Your Tax rate is 15%";

        else if(Income>=37451;Income<=96700)
            rate = .27;
            cout << "Your Tax rate is 27%";

        else if(Income>=96701;Income<=156600)
            rate = .30;
            cout << "Your Tax rate is 30%";

        else if(Income>=156601;Income<=307050)
            rate = .35;
            cout << "Your Tax rate is 35%";

        else if(Income>=307051)
            rate = .385;
            cout << "Your Tax rate is 38.6%%";

        break;

I defined double rate = 0;

Aucun commentaire:

Enregistrer un commentaire