-
Notifications
You must be signed in to change notification settings - Fork 0
W03 ‐ Arrays and Control structures (ASSESSED)
Join the third workshop (the first assessed) at the dedicated LINK 💻
This task will help you practice working with arrays, variables, built-in data types, and control structures in C++. Moreover, it assesses the definition of a class, object instantiation, and how to manage data using objects.
You are tasked with writing a C++ program to analyse the scores of a class of students. Your program should define a Student class to store individual student scores and then calculate and display various statistics based on the provided scores.
- Define a class named Student with the following attributes:
- An integer variable named score to store the student's score.
- A constructor that takes an integer parameter and initializes the score attribute.
- A method for setting the score of a student.
- Calculate and display the following statistics:
- The average score of the students.
- The highest score achieved by a student.
- The lowest score achieved by a student.
- The number of students who scored above the average.
- The number of students who scored below the average.
NB: You don't need to worry about instantiating and initialising objects of class Student, that is done within the test script as in the following image. Please do not create a main()
function in the file you should edit.
Note: You should use appropriate control structures (loops, conditionals) and class methods to implement the required functionality.