Tuesday, March 31, 2015

Getting into UCees --- nested if statements

Script

// If you have a GPA of more than 3.75 in high school and if you also have a SAT score of more than 2250, you can get into
// UC Berkeley.  Provided you have the above two criteria, if your essay is outstanding, you can get into Computer Science major
//  in UC Berkeley.  If your essay is deemed excellent, you can get into Political Science.  If your essay is anything less than 
// excellent, you will be admitted to Liberal Arts.
// If you have a GPA between 3.25 and 3.75 and if you have also scored more than 2250 in SAT, you will get admission 
// into UC Los Angeles.
// Provided you have the two above-mentioned criteria, if your essay is outstanding you will be admitted to Psychology.
// If you essay is excellent but not outstanding you will be able to take up Economics as major.  
// If the essay is anything less than excellent,
// you will be able to get into Neuroscience as your major.
// If your GPA in High School is greater than or equal to 3.25, you will be required to get into Community college.  
// Less than 3.25 on your GPA being the case, if you score 2100 or more in SAT, you will be able to 
// pursue Anthropology in Community college.
// However if you get less than 2100, you will have to settle for Social Sciences in Community college.

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

int main()
{
        string name="";
        cout << "What is your name, please ? : ";
        getline(cin,name);

        double gpaScore=0;
        int satScore=0;
        string essayRating="";
        cout << "What is your High School GPA score ? : ";
        cin >> gpaScore;
        cout << "What is your SAT score ? : ";
        cin >> satScore;
        cout << "Specify what rating you have received for your Essay (Outstanding, Excellent, Good, Moderate, Poor) : ";
        cin >> essayRating;

        if (gpaScore > 3.75 && satScore > 2250)
        {
                if (essayRating == "Outstanding")
                cout << "Congratulations, you are admitted to Computer Science in UC Berkeley.\n";
                else if (essayRating == "Excellent")
                cout << "You are admitted to Political Science in UC Berkeley.\n";
                else
                cout << "You need to take up Liberal Arts in UC Berkeley.\n";

        }

        else if (gpaScore >= 3.25 && gpaScore <= 3.75 && satScore > 2250)
        {
                if (essayRating == "Outstanding")
                cout << "You are admitted to Psychology in UC Los Angeles.\n";
                else if (essayRating == "Excellent")
                cout << "You are eligible to take up Economics as major in UC Los Angeles.\n";
                else
                cout << "You can join UC Los Angeles and do Neuroscience as your major.\n";

        }

        else if (gpaScore >= 3.25 && satScore >= 2100 && satScore <= 2250)
                cout << "You are admitted to Community college for majoring in Anthropology.\n";
                else
                cout << "Please get enrolled into Social Sciences in this Community college.\n";


}


Execution

What is your name, please ? : Kiran DS
What is your High School GPA score ? : 3.8
What is your SAT score ? : 2254
Specify what rating you have received for your Essay (Outstanding, Excellent, Good, Moderate, Poor) : Excellent
You are admitted to Political Science in UC Berkeley.




What is your name, please ? : Roger Smith
What is your High School GPA score ? : 3.87
What is your SAT score ? : 2360
Specify what rating you have received for your Essay (Outstanding, Excellent, Good, Moderate, Poor) : Outstanding
Congratulations, you are admitted to Computer Science in UC Berkeley.



What is your name, please ? : Bill Blofeld
What is your High School GPA score ? : 3.9
What is your SAT score ? : 2240
Specify what rating you have received for your Essay (Outstanding, Excellent, Good, Moderate, Poor) : Excellent
You are admitted to Community college for majoring in Anthropology.


What is your name, please ? : Vikram Kashyap
What is your High School GPA score ? : 3.6
What is your SAT score ? : 2270
Specify what rating you have received for your Essay (Outstanding, Excellent, Good, Moderate, Poor) : Excellent
You are eligible to take up Economics as major in UC Los Angeles.



No comments:

Post a Comment