Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Many prestigious universities used to have a system called a \"legacy preference

ID: 3537121 • Letter: M

Question

 Many prestigious universities used to have a system called a  "legacy preference system (I hope these are gone now)" which is used to decide which  applicants should be accepted to the university.   If an applicant's parent is an alumnus of the university,  the applicant will be admitted with lower GPA and SAT scores  than if the parent is not an alumnus.  (There is currently a lot of discussion about the fairness of this  system, but universities get a lot of money from their alumni so  they are unwilling to change it!!)  Your assignment for MP3 is to implement a computerized system like  this for a very small prestigious university. The university has two  schools, liberal arts and music, each with their own criteria for  accepting students. Your program must read in certain information  about an applicant and print a message saying whether the applicant  should be accepted or not.  The criteria for acceptance are:  Liberal Arts 1. No more than 5 people can be accepted. 2. If a parent is an alumnus, the GPA must be at least 3.0, but  if no parents are alumni the GPA must be at least 3.5. 3. If a parent is an alumnus, the combined SAT score must be at  least 1000, but if no parents are alumni the SAT must be at least  1200.  Music - no preferences for alumni here. 1. No more than 3 people can be accepted. 2. Math and verbal SAT's must be at least 500.  Your program must accept as input the school the student is applying  to (L or M), their high school grade point average, their math SAT  score, their verbal SAT score and whether or not either parent is an  alumnus (Y or N).  The program must process several applicants,  echoing the data for each applicant and printing a message  indicating if the student was accepted to the school they were  applying to. If they were not accepted, the message should indicate  why.  This message only has to indicate one reason for failure in  cases of multiple disqualifications.  Acceptances are to be made in  the order received so that if a school is full, a later applicant  cannot be accepted even if they happen to have better qualifications  than an earlier one.  You do NOT have to check for bad data coming  from the file - assume that it is in the required format and has  appropriate values.   The data file is arranged with the information for each applicant  on a separate line. Your program  must process the data until the  end of file is reached, at which time the program must print out  the total number of applicants and the number of acceptances to  each school.  The data file should contain the following:  L 4.0 600 650 N M 3.9 610 520 N L 3.8 590 600 N L 3.0 600 600 Y L 3.4 600 600 N L 3.0 500 490 Y L 2.9 500 500 Y M 3.5 500 490 Y M 3.9 490 600 Y L 3.5 700 500 N L 3.1 600 400 Y L 3.0 490 510 Y L 4.0 800 800 Y M 3.2 500 500 N   Get an electronic  copy of this file and store it in the same project folder as your  program.                                   SUGGESTION You should design, compile, run and debug your program in stages.   You might start by testing if your program can just read and echo  the data file.  After this is working accurately move on to  identifying the school the person is applying to - then continue  to add more of the details.  Remember to use good style with  consistent indentation, plenty of comments, good variable names  etc. and don't forget to echo the data as it is read.  The output  must be clear and readable with appropriate string constants and  spacing.  Sample output from the first few lines(Replace Clem's name with yours)  of the data file follows:  Acceptance to College by Clem Hasselbach  Applicant #: 1 School = L GPA = 4.0 math = 600 verbal = 650 alumnus = N Applying to Liberal Arts Accepted to Liberal Arts!!! ******************************* Applicant #: 2 School = M GPA = 3.9 math = 610 verbal = 520 alumnus = N Applying to Music Accepted to Music!! ******************************* Applicant #: 3 School = L GPA = 3.8 math = 590 verbal = 600 alumnus = N Applying to Liberal Arts Rejected - SAT is too low *******************************
 what is the source code and the output?

Explanation / Answer

#include<iostream>

#include<fstream>


using namespace std;


int main()

{

char inputFile[30];

cout<<"Enter the input file name : ";

cin>>inputFile;


ifstream in(inputFile);

if(!in)

{

cout<<"file read error :";

return 1;

}


char school;

double highSchoolGrade;

double mathSatScore;

double verbalSatScore;

char alumni;

int liberalArtsSchoolSeats=5;

int musicSchoolSeats=3;

int i=0;


while(!in.eof())

{

in>>school;

in>>highSchoolGrade;

in>>mathSatScore;

in>>verbalSatScore;

in>>alumni;

i++;

cout<<"Applicant #: "<<i<<endl;

cout<<"School = "<<school;

cout<<" GPA = "<<highSchoolGrade;

cout<<" Math = "<<mathSatScore;

cout<<" Verbal = "<<verbalSatScore;

cout<<" Alumnus= "<<alumni<<endl;


if(school=='L')

{

cout<<"Applying to Liberal Arts ";

if(liberalArtsSchoolSeats>0)

{

if(alumni=='Y')

{

if(highSchoolGrade<3.0)

cout<<"Rejected - High school Grade is too low ";

else if(mathSatScore+verbalSatScore<1000)

cout<<"Rejected - SAT is too low ";

else

{

cout<<"Accepted to Liberal Arts!! ";

liberalArtsSchoolSeats--;

}

}

else

{

if(highSchoolGrade<3.5)

cout<<"Rejected - High school Grade is too low ";

else if(mathSatScore+verbalSatScore<1200)

cout<<"Rejected - SAT is too low ";

else

{

cout<<"Accepted to Liberal Arts!! ";

liberalArtsSchoolSeats--;


}


}






}

else

{


cout<<"Rejected -All the seats are full ";

}


}

else

{

cout<<"Applying to Music ";

if(musicSchoolSeats>0)

{

if(mathSatScore+verbalSatScore<500)

cout<<"Rejected - SAT is too low ";

else

{

cout<<"Accepted to Music!! ";

musicSchoolSeats--;



}


}

else

{

cout<<"Rejected -All the seats are full ";

}

}


cout<<"******************************* ";

}


return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote