Question: Simple Error Handling It is likely that as you were interacting with the GPACalculator program you encountered some runtime errors depending on the input values

Simple Error Handling It is likely that as you were interacting with the GPACalculator program you encountered some runtime errors depending on the input values you tried to enter. Taking a closer look at our program we would notice that we do not have any form of error checking and handling in our code. The closest thing we have is the if statements in the getLetterGradeValue that return -1 when an entered letter does not match any of our letter grades to points mapping. Let's try and see how our program behaves when we don't give it the values it expects and can handle properly.


Run the GPA Calculator program and try the scenario that uses negative values when prompted for a letter grade, and negative and zero values for the credit hours.

Step by Step Solution

3.53 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

CODE IN PYTHON def getLetterGradeValuelettergrade grademapping A 40 B 30 C 20 D 10 F 00 ... View full answer

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 Programming Questions!