73.4k views
2 votes
Lab 5: Test Average and Grade using Functions Hide Assignment Information Instructions For Lab \#5 complete Programming Exercises \#15 from chapter 5. It mentions that your program should work by using those two value returning functions. There are multiple ways to solve this one, but the only input from the user should be the five test scores. The program should print out the average score and Letter grade. Be sure to submit your file by Monday March 6th 1159pm Start Date Feb 27, 2023 8:00 AM Due Date Mar 6, 2023 11:59 PM

User Elyptikus
by
8.2k points

1 Answer

7 votes

Final answer:

To solve this lab assignment, you need to write a program that calculates the average test score and letter grade for a student. The program should use two value-returning functions to calculate the average score and determine the letter grade based on the average. The only input from the user should be the five test scores.

Step-by-step explanation:

To solve this lab assignment, you need to write a program that calculates the average test score and letter grade for a student. The program should use two value-returning functions to calculate the average score and determine the letter grade based on the average. The only input from the user should be the five test scores.

Here is a step-by-step guide:

  1. Write a function that takes five test scores as input and returns their average. You can use the formula: average = (score1 + score2 + score3 + score4 + score5) / 5.
  2. Write a function that takes the average score as input and returns the corresponding letter grade. You can use a series of if-else statements to determine the grade based on the average score.
  3. In your main program, prompt the user to enter the five test scores.
  4. Call the average function with the test scores as arguments to calculate the average.
  5. Call the letter grade function with the average as argument to determine the grade.
  6. Print out the average score and the letter grade.
User Navid Farahzadi
by
8.5k points