OOP - Assignment 1

So let's get cracking with our first Assignment for OOP.

We're after week 2 as for now and what we know so far is very basic. Even if you look at the first question that mentions an interface, you might ask yourself what the hell is that...

The fact is that a lot of information required for this Assignment will come up during next 3 weeks, so... I'll be googling a lot! Feel free to do the same with me here.

Ok, question A:
a) Create a CalculateGrade interface which specifies two methods
i) calculate GradeAverage
ii) assign Grade

What is an interface? Have a look at this article, as it explain it very well. Short introduction how to implement it in our assignment below:


Question B:
b) Design a Class which represents a Student which implements CalculateGrade. It is to have the following fields, Name, Student Number, Course, Current Year , Registration Status, An Arraylist of marks for the 10 topics the student is studying as part of their Course. You are to implement i) calculateGradeAverage to calculate the average of all the subject marks recorded for the student and ii) assignGrade to output a corresponding grade for the calculated grade average according to the scheme
A grade for a grade average over 80
B grade for a grade average greater than or equal to 70 and less than 80
C grade for a grade average greater than or equal to  60 and less than 70
D grade for a grade average greater than or equal to  50 and less than 60
E grade for a grade average greater than or equal to  40 and less than 50
F grade for a grade average  less than 40

Below my video on creating Student class:


And here - how to test it:



Question C:
c) Design an Undergraduate subclass of the Student class. It is to have the following extra fields: stream which indicates the particular stream of a course a student is following e.g. data Analytics in a Computer Science course, and a field representing their Final year project topic. You are to have a method that works out the initials of an Undergraduate and displays these. You are also to have a method which displays a warning for any Undergraduate whose grade average is less than a D grade.

A subclass extends its super class to inherit some of the super class' fields and methods. Below a couple of notes about how to approach the Undergraduate subclass:


Part two: finishing Undergraduate subclass and testing it with use of a static variable below:



Question D:
d) Write a program which creates 20 instances of Undergraduates. It is to display the name of the Undergraduate with the highest average mark overall. It is also to display the name of the Undergraduate with the highest average mark in each stream. It is also to display a warning and the initials of  all graduates  whose grade average is less than a D grade. 

For now, here's an overly-done example that I came up with - but no code yet! Just a couple of notes and hints before you start making your own program. If you watched all my videos and did the testing programs, you should have a good idea how to make the main class that will utilise the classes we just created. Good luck!


Pretty intense, huh? If you're all done with this assignment, make sure you post the screenshot of your terminal screen with a running program on Facebook :) Again, probably something less complicated than in the video above, but as long as it works - feel free to brag about it! :)

There's no video about the main function, but for now you can find the finished assignment in a link below:

Comments