anyone know how i can fix this... i only have one wrong and i have no idea what
ID: 3882715 • Letter: A
Question
anyone know how i can fix this... i only have one wrong and i have no idea what to do to fix it.
int run()
{
// 1. Title and heading
cout << STUDENT << "-" << ASSIGNMENT << "-Graduation Calculator" << endl;
cout << "-----------------------------------------" << endl;
// 2. Input section
cout << "Enter your gpa, total credits and honors credits: ";
double gpa;
int credits, honorsCredits;
cin >> gpa >> credits >> honorsCredits;
// 3. Processing section
string result = "Invalid";
// PUT YOUR CODE BELOW THIS LINE
if( gpa < 2.0 || credits < 180)
result= "not graduating"; // this line is always true and I dont know why
else
{
if(gpa >= 2.0 && gpa <= 3.6)
result= "graduating";
else if(honorsCredits < 15)
{
if(gpa >= 3.6 && gpa < 3.8)
result = "cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
else
{
if(gpa >= 3.6 && gpa < 3.8)
result= "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "summa cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
}
// PUT YOUR CODE ABOVE THIS LINE
// 4. Output section
cout << "The result is ["" << result << ""]" << endl;
return 0;
}
Chrome File Edit View History Bookmarks People Window Help CS 150-23378 C-X" Rcs 150 (69 unrea X1. CS 150-C++ Prc XyDCS501DE xCho3-DecisionsAr xC Chegg Study | Gui x c secure | https://ide.cs50.io/soctavio98/.de50#openfile-x Screen Shot 2017-09-.. .46.40 PM CS50 IDE File Edit Find View Go Window v114 9 Share *.- h04.cpp h03.cpp double gpo int credits, honorscredits; cin gpa credits honorstredits s150 Screen Shot 2017-07-....27,44 PM 3 Processing section string result "Invalid PUT YOUR CODE BELOW THIS LINE h01 result "not graduating; / this line is always true and I cont lenow why else h03 h03.cpp h03.0 result- graduating 4 else if(honorsCredits 15) h03.tests Octavio-Sanchez B junk.bxt result "cum laude"; Resume.pdf libh03.a else if(gpa >. 3.8 ) makefile 51 result "magna cum Laude h04 h04.cpp h04.0 libh04.a else 2017 08 07 S6 result-'mo an laude". 61 62 else if(gpa >e 3.8 result summa cum Laude Medi-Cal For Families july 21 practice 70:1 C and C++ Tabs:4 Input of 4.8 5000 14-nagna cun Lause" Input of 3.79 190 15-nagna cun Laude cover letter ikea H04:soctav10:ALL TESTS PASS 14/1S [93%) - 10Explanation / Answer
Your error is in the following line perhaps
else if(gpa >= 2.0 && gpa <= 3.6)
instead above line, it should be ---> else if(gpa >= 2.0 && gpa < 3.6)
The corrected program is below.
#include<iostream>
using namespace std;
int run()
{
// 1. Title and heading
cout << "STUDENT" << "-" << "ASSIGNMENT" << "-Graduation Calculator" << endl;
cout << "----------------------------------------" << endl;
// 2. Input section
cout << "Enter your gpa, total credits and honors credits: ";
double gpa;
int credits, honorsCredits;
cin >> gpa >> credits >> honorsCredits;
// 3. Processing section
string result = "Invalid";
// PUT YOUR CODE BELOW THIS LINE
if( gpa < 2.0 || credits < 180)
result= "not graduating"; // this line is always true and I dont know why
else if(gpa >= 2.0 && gpa < 3.6) // put this in an else-if
result= "graduating";
else if(honorsCredits < 15)
{
if(gpa >= 3.6 && gpa < 3.8)
result = "cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
else
{
if(gpa >= 3.6 && gpa < 3.8)
result= "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "summa cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
}
// PUT YOUR CODE ABOVE THIS LINE
// 4. Output section
cout << "The result is ["" << result << ""]" << endl;
return 0;
}
int main()
{
run();
}
#include<iostream>
using namespace std;
int run()
{
// 1. Title and heading
cout << "STUDENT" << "-" << "ASSIGNMENT" << "-Graduation Calculator" << endl;
cout << "----------------------------------------" << endl;
// 2. Input section
cout << "Enter your gpa, total credits and honors credits: ";
double gpa;
int credits, honorsCredits;
cin >> gpa >> credits >> honorsCredits;
// 3. Processing section
string result = "Invalid";
// PUT YOUR CODE BELOW THIS LINE
if( gpa < 2.0 || credits < 180)
result= "not graduating"; // this line is always true and I dont know why
else if(gpa >= 2.0 && gpa < 3.6) // put this in an else-if
result= "graduating";
else if(honorsCredits < 15)
{
if(gpa >= 3.6 && gpa < 3.8)
result = "cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
else
{
if(gpa >= 3.6 && gpa < 3.8)
result= "magna cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
else if(gpa >= 3.8 )
result = "summa cam laude"; // change the letter a to u for the word cam because c_u_m is considered innapropiate in chegg
}
}
// PUT YOUR CODE ABOVE THIS LINE
// 4. Output section
cout << "The result is ["" << result << ""]" << endl;
return 0;
}
int main()
{
run();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.