Write a program to check if a student is eligible for a master’s program at UD. A person is eligible if their GPA is above 3.0. If a person is an Emirati, the minimum GPA requirement is reduced to 2.5. Write a program that asks that checks for this information. Your program should print “Person is eligible” or “Person is not eligible”.
#include<iostream>
using namespace std;
//The start point of the program
int main()
{
//Declare variable GPA
float GPA;
//Declare variable isEmirati
int isEmirati=0;
//get a student GPA from the user
cout<<"Enter a student GPA: ";
cin>>GPA;
if(GPA>=2.5){
//check if a person is an Emirati, get answer from the user
while(isEmirati<1 || isEmirati>2){
cout<<"Is a person an Emirati? (1-yes, 2- no): ";
cin>>isEmirati;
}
}
//A person is eligible if their GPA is above 3.0.
if((isEmirati==2 && GPA>=3.0) || (isEmirati==1 && GPA>=2.5)){
//If a person is an Emirati, the minimum GPA requirement is reduced to 2.5.
cout<<"Person is eligible\n\n";
}else{
// print "Person is eligible" or "Person is not eligible".
cout<<"Person is not eligible\n\n";
}
//delay
system("pause");
return 0;
}
Comments
Leave a comment