Question: Write a function that takes in a numeric grade and returns a letter grade. 90+ is an A, 80-90 is a B, anything below that

 Write a function that takes in a numeric grade and returns
a letter grade. 90+ is an A, 80-90 is a B, anything

Write a function that takes in a numeric grade and returns a letter grade. 90+ is an A, 80-90 is a B, anything below that is a C. As before, we'll test this function by calling it from the command window. Extra credit: Add in +,- for > X7.5 and that's an A o Check if the grade is larger than 80 -> that's a B o Otherwise, a C Extra credit: The point is to do this without just using a huge number of if statements. That way, if you were to add in additional letter grades (D and F) or change the boundaries (to 0.3 and 0.7) the code would be easy to change. o Calculate the "left over" - e.g. (grade -80) for a B grade After you assign the main letter grade, add in the + or to the current letter, based on the value of the left over. I.e., if the leftover were less than 0.25, you would add a to the 'B' string Self-check: >> str = LetterGrade (95) str = >> str = LetterGrade (85) str = B >> str = LetterGrade (75) str = EXTRA CREDIT: >> str = LetterGrade (98) str = >> str = LetterGrade ( 82) str =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!