Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include using namespace std; void getGrades ( char grades [ ] ) { string courses [ ] = { CIS 1 0

#include
#include
#include
using namespace std;
void getGrades(char grades[]){
string courses[]={"CIS 101", "CIS 120", "CIS 210","CS 113 or 116","CS 136","CS 213 or 216","CS 130","CS 131"};
cout "Please enter your letter grade for each specified course and press enter after each one:" endl;
for (int i =0; i 8; i++){
cout courses[i]": ";
cin >> grades[i];
grades[i]= toupper(grades[i]);
}
}
int gradeToScore(char grade){
switch (grade){
case 'A': return 95;
case 'B': return 85;
case 'C': return 75;
case 'D': return 65;
case 'F': return 0;
default: return 0;
}
}
void getScores(const char grades[], int scores[]){
for (int i =0; i 8; i++){
scores[i]= gradeToScore(grades[i]);
}
}
bool areAllAbove65(const int scores[]){
for (int i =0; i 8; i++){
if (scores[i]65){
return false;
}
}
return true;
}
double computeAverage(const int scores[]){
int sum =0;
for (int i =0; i 8; i++){
sum += scores[i];
}
return static_cast(sum)/8;
}
double computeUpperLevelAverage(const int scores[]){
int sum =0;
for (int i =4; i 8; i++){
sum += scores[i];
}
return static_cast(sum)/4;
}
int countAbove85(const int scores[]){
int count =0;
for (int i =0; i 8; i++){
if (scores[i]>85){
count++;
}
}
return count;
}
void gatherAdditionalInfoAndCalculateCriteria(int& criteria5_score, int& criteria6_score, int& criteria7_score){
float nonCS_GPA;
char volunteering_experience;
int years_of_experience;
cout "Please enter your non-CS GPA: ";
cin >> nonCS_GPA;
if (nonCS_GPA >=4.0){
criteria5_score =100;
} else if (nonCS_GPA >=3.5){
criteria5_score =90;
} else if (nonCS_GPA >=3.0){
criteria5_score =80;
} else if (nonCS_GPA >=2.5){
criteria5_score =50;
}
cout "Do you have previous volunteering experience? Please enter Y or y for yes or N or n for no: ";
cin >> volunteering_experience;
if (volunteering_experience =='y'|| volunteering_experience =='Y'){
criteria6_score =50;
}
cout "Please enter the number of years in a related job or internship: ";
cin >> years_of_experience;
if (years_of_experience >=3){
criteria7_score =100;
} else if (years_of_experience >=2){
criteria7_score =75;
} else if (years_of_experience >=1){
criteria7_score =50;
}
}
void displayResults(const string& firstName, const string& lastName, int totalScore){
cout "Application score for " lastName "," firstName ": " totalScore endl;
}
void processApplicant(){
string firstName, lastName;
const int NUM_GRADES =8;
char grades[NUM_GRADES];
int scores[NUM_GRADES];
int criteria1_score =0, criteria2_score =0, criteria3_score =0, criteria4_score =0;
int criteria5_score =0, criteria6_score =0, criteria7_score =0;
cout "Please enter your first name: ";
cin >> firstName;
cout "Please enter your last name: ";
cin >> lastName;
getGrades(grades);
getScores(grades, scores);
double average = computeAverage(scores);
if (average >90){
criteria1_score =100;
} else if (average >85){
criteria1_score =90;
}
if (areAllAbove65(scores)){
criteria2_score =100;
}
if (countAbove85(scores)>=4){
criteria3_score =100;
}
double upperLevelAverage = computeUpperLevelAverage(scores);
if (upperLevelAverage >90){
criteria4_score =100;
} else if (upperLevelAverage >85){
criteria4_score =90;
}
gatherAdditionalInfoAndCalculateCriteria(criteria5_score, criteria6_score, criteria7_score);
int totalScore = criteria1_score + criteria2_score + criteria3_score + criteria4_score + criteria5_score + criteria6_score + criteria7_score;
displayResults(firstName, lastName, totalScore);
}
int main(){
int numApplicants;
cout "Enter the number of applicants: ";
cin >> numApplicants;
for (int i =0; i numApplicants; i++){
cout "
Applicant " i +1":" endl;
processApplicant();
}
return 0;
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How much time will be required to drill the hole in Problem 1?

Answered: 1 week ago

Question

Define productivity measurement.

Answered: 1 week ago

Question

Explain the role of research design in HRD evaluation

Answered: 1 week ago