Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

whats wrong with my code? // output int run() { /* Input: title and entering the letter grade output: the value of the grade Processing:

whats wrong with my code? // output

int run() { /* Input: title and entering the letter grade output: the value of the grade Processing: */

// title

cout

// input

cout

//processing

double gradePoints = -1; // error condition if -1

if(gradeIn == "A") gradePoints = 4.0; else if(gradeIn == "A-") gradePoints = 3.7; else if(gradeIn == "B+") gradePoints = 3.3; else if(gradeIn == "B") gradePoints = 3.0; else if(gradeIn == "B-") gradePoints = 2.7; else if(gradeIn == "C+") gradePoints = 2.3; else if(gradeIn == "C") gradePoints = 2.0; else if(gradeIn == "C-") gradePoints = 1.7; else if(gradeIn == "D+") gradePoints = 1.3; else if(gradeIn == "D") gradePoints = 1.0; else if(gradeIn == "D-") gradePoints = 0.7; else if(gradeIn == "F") gradePoints = 0;

//output

cout = 0) { cout

string errorMessage;

if(gradeIn == "A+" || gradeIn == "F+" || gradeIn == "F-") { errorMessage = "INVALID GRADE COMBINATION"; }

cout

}

else if (gradeIn.size() >= 1) { if (gradeIn.at(0) != 'A' && gradeIn.at(0) != 'B' && gradeIn.at(0) != 'C' && gradeIn.at(0) != 'D' && gradeIn.at(0) != 'F') { invalidMessage = "INVALID LETTER GRADE" } cout

} else cout

return 0; }

image text in transcribedimage text in transcribedimage text in transcribed

Chrome File Edit View History Bookmarks People Window Help tavi c secure! https://ide.cs50.io/soctavio98/ide50#openfile-X CS50 IDE File Edit Find View Go Window v114 9 Share .- /workspace * cs150 h03.cpp x h02.cpp 87 Screen Shot 2017-07-....27.44 PM else if (grade!n.sizeO >-1) 89 90 91 92 93 94 95 96 97 98 if h02 invalidMessage "INVALID LETTER GRADE h02 cout 1) h03.cpp:102:6: error: expected unqualified-id practice return cover letter ikea 150config.py h03.cpp:103:1: error: extraneous closing brace 3 errors generated nake: (he3.ol Error 1 /workspace/cs150/hw/h03/ Make Payment 2017 fall

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions