Challenge 36

🏫

Class Scores

Open in Code Editor or Copy Instructions
...solutions at bottom of page...

There is a class of 10 students. Each student takes 3 tests. You should create 2 arrays: 1 representing the student's names and another representing their test scores. The student at index 1 of the names array should also have their scores at index 1 of the scores array and so on

Your program should output following information:

Examples:

Assumes names are: ["Andy", "Betty", ..., "Jessica"] and the scores are [[65, 72, 58], [93, 81, 86], ..., [43, 56, 52]]

The output could be the following:

Andy's average score was 65%

Betty's average score was 86.7%

...

Jessica's average score was 86.7%

------------

Test 1 average was 67%

Test 2 average was 69.7%

Test 3 average was 65.3%

------------

Jessica failed test 1

Extension:

Prompt the user to enter the information - names and scores. Validate their input - e.g. names shouldn't be empty and scores should be in the range 0 to 100 inclusive

Solutions

IGCSE 0478 / O-Level 2210 A-Level 9618