A lecturer makes use of a list to store the scores of a test similar to the following:   var scores = [45,50,89,90,46,67]   Each element in the list represents the score obtained by student i, where i is the respective index.   To help the lecturer perform some operations, you are required to write and test the following functions Function called captureScores This function accepts an integer representing the number of students in the class e.g. 5 It then captures the scores for the 5 students, one by one, adding them to a list of integers Finally, it returns the list once all n scores have been captured. Hint – Make use of a loop. Start with an empty list, use the add() method to populate your list with scores, one by one as they are captured. Function called printResults that takes a list of integers as an argument ( e.g. list scores) and prints the result for each score using the following grading scheme   Score                                     Result 0 – 44                                    Fail 45 – 49                                  Supp 50 – 79                                  Pass 80 – 100                                Distinction Function called findHighest that takes a list of integers as an argument ( e.g. list scores) and returns the maximum value in the list. Function called findLowest that takes a list of integers as an argument ( e.g. list scores) and returns the minimum value in the list. Function called getSum that takes a list of integers as an argument ( e.g. list scores) and returns the sum of all the values in the list. Function called getAverage that takes a list of integers as an argument ( e.g. list scores) and returns the average score of all the values in the list. Average = sum/number of students. Function called getPassRate that takes a list of integers as an argument ( e.g. list scores) and an integer representing the pass mark and returns the pass rate as a percentage. Pass Rate = (Number of Students with a score >= pass mark / Total Number of Students)*100. Function called printMenu that prints a menu showing the following operations that correspond to each of the operations mentioned above   Score Manager Capture Scores Print Results Find Highest Score Find Lowest Score Get the Sum of Scores Get Average Score Get Pass Rate Exit     method main() Make use of the functions you wrote above to implement a simple score management system that presents the user with the Menu above (see 8), and allows the user to repeatedly carry out any of the desired operations ( 1…7, and only terminates the program when option 8 (Exit) is chosen.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

A lecturer makes use of a list to store the scores of a test similar to the following:

 

var scores = [45,50,89,90,46,67]

 

Each element in the list represents the score obtained by student i, where i is the respective index.

 

To help the lecturer perform some operations, you are required to write and test the following functions

  • Function called captureScores
    1. This function accepts an integer representing the number of students in the class e.g. 5
    2. It then captures the scores for the 5 students, one by one, adding them to a list of integers
    3. Finally, it returns the list once all n scores have been captured.

Hint – Make use of a loop. Start with an empty list, use the add() method to populate your list with scores, one by one as they are captured.

  • Function called printResults that takes a list of integers as an argument ( e.g. list scores) and

prints the result for each score using the following grading scheme

 

Score                                     Result

0 – 44                                    Fail

45 – 49                                  Supp

50 – 79                                  Pass

80 – 100                                Distinction

  • Function called findHighest that takes a list of integers as an argument ( e.g. list scores) and returns the maximum value in the list.
  • Function called findLowest that takes a list of integers as an argument ( e.g. list scores) and returns the minimum value in the list.
  • Function called getSum that takes a list of integers as an argument ( e.g. list scores) and returns the sum of all the values in the list.
  • Function called getAverage that takes a list of integers as an argument ( e.g. list scores) and returns the average score of all the values in the list. Average = sum/number of students.
  • Function called getPassRate that takes a list of integers as an argument ( e.g. list scores) and an integer representing the pass mark and returns the pass rate as a percentage.

Pass Rate = (Number of Students with a score >= pass mark / Total Number of Students)*100.

  • Function called printMenu that prints a menu showing the following operations that correspond to each of the operations mentioned above

 

Score Manager

  1. Capture Scores
  2. Print Results
  3. Find Highest Score
  4. Find Lowest Score
  5. Get the Sum of Scores
  6. Get Average Score
  7. Get Pass Rate
  8. Exit

 

 

  • method main()

Make use of the functions you wrote above to implement a simple score management system that presents the user with the Menu above (see 8), and allows the user to repeatedly carry out any of the desired operations ( 1…7, and only terminates the program when option 8 (Exit) is chosen.

Expert Solution
steps

Step by step

Solved in 3 steps with 14 images

Blurred answer
Knowledge Booster
Array
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education