TO BE WRITTEN IN C++ format: Write a program to plan your future, using the foll
ID: 3791109 • Letter: T
Question
TO BE WRITTEN IN C++ format:
Write a program to plan your future, using the following data The correct solution will have the results shown higher toward the top. Only one result per run! See the examples run below.
MAJOR GPA RESULT
computer science Greater than or equal to 3.5 I think you go to grad school to get a PhD in CS.
computer science Greater than or equal to 3.0, but less than 3.5 I think you should get an MS in CS while working in the field.
computer science Less than 3.0 There are lots of amazing jobs in CS.
business Greater than 3.3 I think an MBA is in your future!
premed Greater than 3.7 Med school, here you come!
Any Greater than or equal to 2.0 Having a college degree is a real benefit to your marketability.
Any Less than 2.0 You really need to work on your grades!
Example run 1
:
Enter your major: computer science
Enter your gpa: 2
There are lots of amazing jobs in CS
.
Example run 2
:
Enter your major: anthropology
Enter your gpa: 2
Having a college degree is a real benefit to your marketability
.
Example run 3
:
Enter your major: premed
Enter your gpa: 3.5
Having a college degree is a real benefit to your marketability
.
Run it at least
7 times
with different data,
showing at least one run from each
category of data.
Thank you!
Explanation / Answer
program:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string major;
float gpa;
cout << "Enter your major: ";
getline(cin,major);
cout << "Enter your gpa: ";
cin>> gpa;
if(major.compare("computer science")==0){
if(gpa>=3.5){
cout <<"I think you go to grad school to get a PhD in CS.";
}
else if(gpa>=3.0){
cout<<"I think you should get an MS in CS while working in the field.";
}
else{
cout<<"There are lots of amazing jobs in CS.";
}
}
else if(major.compare("business")==0 && gpa>3.3){
cout<<"I think an MBA is in your future!";
}
else if(major.compare("premed")==0 && gpa>3.7){
cout<<"Med school, here you come!";
}
else{
if(gpa>=2.0){
cout<<"Having a college degree is a real benefit to your marketability.";
}
else{
cout<<"You really need to work on your grades!";
}
}
}
Sample run 1:
Enter your major: computer science
Enter your gpa: 3.5
I think you go to grad school to get a PhD in CS.
Sample run 2:
Enter your major: computer science
Enter your gpa: 3.4
I think you should get an MS in CS while working in the field.
Sample run 3:
Enter your major: computer science
Enter your gpa: 1
There are lots of amazing jobs in CS.
Sample run 4:
Enter your major: business
Enter your gpa: 3.9
I think an MBA is in your future!
Sample run 5:
Enter your major: premed
Enter your gpa: 3.7
Med school, here you come!
Sample run 6:
Enter your major: anthropology
Enter your gpa: 2
Having a college degree is a real benefit to your marketability.
Sample run 7:
Enter your major: premed
Enter your gpa: 1
You really need to work on your grades!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.