Question
The Graduation Problem Many 4-year Universities are on the quarter-credit (rather thansemester) system. You are given a student's GPA, total creditcount, and honors credit count
The Graduation Problem
Many 4-year Universities are on the quarter-credit (rather thansemester) system. You are given a student's GPA, total creditcount, and honors credit count as input. The total credit countalready includes the honors credits.
I have already written the run() function. You should declareand define the function getStatus() so that the program workscorrectly.
The graduation status to return is determined by the followingrules:
• Students must have completed at least 180 credits with a GPAof at least 2.0 to graduate. A student who does not meet both ofthese constraints should receive a return value of "notgraduating".
• Students who do have enough credits to graduate andsufficiently high GPAs will receive one of four return valuesdepending on the GPA and number of honors credits:
? All students with GPAs between 2.0 and 3.6 receive a returnvalue of
"graduating".
? Students with fewer than 15 honors credits receive a return of"cume laude" if their GPA is at least 3.6 but less than 3.8, and areturn of "magna cume laude" if their GPA is at least 3.8.
? Students with 15 or more honors credits receive a return of"magna cume laude" if their GPA is at least 3.6 but less than 3.8,and a return of "summa cume laude" if their GPA is at least3.8.
Here are some example inputs and their resulting output:
• For input of 3.87, 178, 16 the output is "not graduating"
• For input of 1.5, 199, 30 the output is "not graduating"
• For input of 2.7, 380, 50 the output is "graduating"
• For input of 3.62, 200, 200 the output is "magna cumelaude"
• For input of 3.93, 185, 0 the output is "magna cume laude"
ERROR! NO TEXT OF SPECIFIED STYLE IN DOCUMENT.3.2
• For input of 3.85, 190, 15 the output is "summa cumelaude"
You can assume that GPA will be between 0.0 and 4.0 and thatboth credit counts will be non-negative integers. You'll find thestarter code in the download folder. To solve this problem, workstep-by-step as we've done in the past.
Note: unlike previous exercises, this will mark your answersright or wrong, but will not tell you what the correct answershould have been when yours is wrong. You will have to calculatethe correct value yourself.
STARTER CODE:
/**
* @author Put your name here
* @date Put the date here
* @file h04.cpp
*/
#include
#include
#include
using namespace std;
string STUDENT = "WHO ARE YOU"; // Add your Canvas loginname
extern string ASSIGNMENT;
// Add your function declaration here
/**
* Describe the purpose of your program here.
* @return 0 for success.
*/
int run()
{
// DON'T CHANGE ANYTHING IN THIS FUNCTION
cout << STUDENT << "-" <
cout << "Enter gpa, total credits andhonors credits: ";
double gpa;
int credits, honorsCredits;
cin >> gpa >> credits >>honorsCredits;
// You will write this function
string result = getStatus(gpa, credits,honorsCredits);
cout << "Result is ["" << result<< ""]" << endl;
return 0;
}
// Implement your function here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started