Question: The Java code below shows how a set of classes work together to allow the following functionality: A Student object represents a students details (name,

The Java code below shows how a set of classes work together to allow the following functionality:

A Student object represents a students details (name, id number).

A Module object represents the details of a study module.

Each Student object can register for a number of Module objects.

A grade can be inserted for each Module object that the student has registered for.

Each Module object can print out the list of students that have registered for it.

Each Module object can print out a list of students ranked by the mark they received.

The Java code below shows how a set of classes work together

(a) Write the Java code for the Student and Module classes making appropriate use of constructor, access modifiers and getter/setter methods.

(b) What data structure could be used in the Student class to record the Modules that a Student has registered for? Explain your answer and show how this would be implemented in Java.

(c) In the code above, a Module object does not appear to explicitly receive a list of the students that have registered with it. However, it can still produce a listing of students. Show how a Module object receives and stores each students details and grade information.

(d) lines 28 and 29 shows a method called rankStudents being called. This method prints out a list of Student names ranked according to their mark in the module. Show how this would be implemented.

5e public static void main(String args) Student skelly= new Student("Sean", "Kelly", 1245780); Student mkehoe new Student(" May", "Kehoe", 12678889); 7 10 Module oop = new Module("OO programming", "CT2106"); Module thermo- new ModuleC"Thermodynamics", "CT2332"); 12 13 14 15 16 17 18 19 20 21 skelly.registerForModule(oop); skelly.registerForModule(thermo); mkehoe.registerForModule(oop); mkehoe.registerForModuleCthermo); skelly.insertGradeCoop, 65); skelly.insertGrade(thermo, 72); mkehoe.insertGradeCoop, 48); mkehoe.insertGrade(thermo, 77); 23 24 25 26 27 28 29 30 31 32 oop.listO; thermo.listO; oop.rankStudentsO; thermo.rankStudentsO: oop.printO; thermo.printo

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!