You are on page 1of 2

Advanced Programming:

LAB02:
In this exercise you will write a class Undergraduate.java that inherits the
Student class.
Undergraduate class has the following data:
int level which describes the year of study.(1: firstYear,2: SecondYear,3:
ThirdYear,4: ForthYear)
The Undergraduate class contains the following constructors:
_public Undergraduate(String name, long id):this constructor initialize
the level with the value 1

_public Undergraduate(String Name,long id, int initialLevel): this


constructor calls the super constructor to inialize the student name and id,
and inialize the student level.

_Write the setters and getters for this class,

_Write a copy constructor public Undergraduate(Undergraduate other)


that constructs Undergraduate object with Undergraduate object as a
parameter.

_The class has the method public boolean sameStudent(Undergraduate


other); the method returns true if other object has the same id number of
the current Undergraduate, otherwise returns false.

_Override toString() for this class, this method returns a strings with all
the data of Undergraduate student.

_Write another class named Graduate, the class has the following data:
GradID.

_Write the constructor method for this class: Graduate(String name, long
id, long gradID)to initialize the object data.
Write a copy constructor public Graduate(Graduate other) that constructs
Graduate object with Graduate object as a parameter.

_Override toString() method for this class.

_Write the getters and setters for this class.


_Write the method public Boolean graduated(): the method computes the
student average and returns true if the average>=60. Otherwise it returns
false.

Write a class named Lab02_Test with main method:


1. Add 4 students, 2 graduate and 2 Undergraduate to student chart
class (implemented in the previous lab) with their grades in their
courses
2. Print the students in the student chart
3. Delete one student from the student chart
4. Print the student chart after deletion
Good Luck.

You might also like