Write the Flowchart and Python code for the following programming problem based on the provided pseudocode. Write a program that will allow a teacher to calculate the average test score for a certain number of students.  The teacher can enter the number of students who took the test, and then the score for each student.  Your program will then calculate the average score and print out the results.  Your program must use the appropriate loop, modules, and run multiple times for different sets of test scores. Your sample output might look as follows: How many students took the test: 9 Enter their score: 98 Enter their score: 78 Enter their score: 99 Enter their score: 92 Enter their score: 87 Enter their score: 100 Enter their score: 88 Enter their score: 81 Enter their score: 79 The average test score is 89 Do you want to end program? (Enter no to process a new set of scores): yes

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 8PE
icon
Related questions
Question

Write the Flowchart and Python code for the following programming problem based on the provided pseudocode.

Write a program that will allow a teacher to calculate the average test score for a certain number of students.  The teacher can enter the number of students who took the test, and then the score for each student.  Your program will then calculate the average score and print out the results.  Your program must use the appropriate loop, modules, and run multiple times for different sets of test scores.

Your sample output might look as follows:

How many students took the test: 9

Enter their score: 98

Enter their score: 78

Enter their score: 99

Enter their score: 92

Enter their score: 87

Enter their score: 100

Enter their score: 88

Enter their score: 81

Enter their score: 79

The average test score is 89

Do you want to end program? (Enter no to process a new set of scores): yes

The Pseudocode

Module main()

//Declare local variables

Call declareVariables (endProgram, totalScores, averageScores, score, number, counter)  

            

            //Loop to run program again

            While endProgram == “no”

                        //reset variables

Call declareVariables (endProgram, totalScores, averageScores, score, number, counter)              

 

//calls functions

Call getNumber(number)

                        Call getScores(totalScores, number, score, counter)

                        Call getAverage(totalScores, number, averageScores)

                        Call printAverage(averageScores)          

Display “Do you want to end the program? (Enter no to process a new set of test scores )”

Input endProgram

            End While        

End Module

Module declareVariables(Real Ref endProgram, Real Ref totalScores, Real Ref averageScores, Real Ref score, Integer Ref number, Integer Ref counter)

Declare String endProgram = “no”

            Declare Real totalScores = 0.0

            Declare Real averageScores = 0.0

            Declare Real score = 0

            Declare Integer number = 0

            Declare Integer counter = 1

End Module

Module getNumber(Integer Ref number)

            Display “How many students took the test: ”

            Input number    

End Module

Module getScores(Real Ref totalScores, Integer number, Real score, Integer counter)

            For counter = 1 to number

                        Display “Enter their score:”

                        Input score

                        Set totalScores = totalScores + score

            End For

End Module

Module getAverage(Real totalScores, Integer number, Real Ref averageScores)

            Set averageScores = totalScores / number

End Module

Module printAverage(Real averageScores)

            Display “The average scores is “, averageScores

End Module

The Flowchart

            PASTE FLOWCHART HERE

The Python Code

            PASTE CODE HERE AND SCREEN SHOT OF CODE RUNNING

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning