Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in python that asks the user to enter 5 test scores. The program should display a letter grade for each test score

Write a program in python that asks the user to enter 5 test scores. The program should display a letter grade for each test score and the average test score. design the following functions in the program: calcAverage-- This function should accept 5 test scores as averages and returns the average of the score. determineGrade -- This function should accept a test score as an argument and return a letter grade for the score (as a string) based on the following grading scale:

90-100 = A

80 - 89 = B

70 - 79 = C

60 - 69 = D

Below 60 = F

Design a program to solve the following Chapter 6 Programming Exercise 7 (Test Average and Grade) on page 329 of your textbook. Additional Problem Requirements:

• Create a main module as your program start module. The purpose of this main controlling module is to create variables, call functions, and descriptively display output. Use only simple data types, not arrays, in your solution.

• In addition to the calcAverage and determineGrade functions, create and use the following additional functions: o getValidScore is a function that has no passed parameters but prompts for, and reads, a single valid test score. A validation loop is used to only allow valid input for subsequent processing. The ‘isValidScore’ function is used to test the user’s input for validity. Once a valid test score has been input, this valid test score is then returned to the calling module. o isValidScore is a function that checks whether a single passed test score is in range (0 inclusive to 100 inclusive) and returns a Boolean indicating if it is valid (True if in range, False if out of range). Be sure to check for non-numeric input!

• The main module will call getValidScore five times: once for each user entered test score. The returned value from getValidScore is a single validated test score input by the user. The main module should then call determineGrade five times: once for each validated test score. The returned value from determineGrade will be displayed as the grade for each user entered and validatedtest score. Finally, the average of all five test scores will be calculated using calcAverage and the returned value displayed to the user along with the grade for the average test score.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

def calcAveragenum1 num2 num3 num4 num5 return num1 num2 num3 num4 num5 5 ... 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

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Given find the value of k. es 1 e kx dx = 1 4'

Answered: 1 week ago