Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Compare and contrast the current ratio and the quick ratio.

Answered: 1 week ago

Question

3 > O Actual direct-labour hours Standard direct-labour hours...

Answered: 1 week ago