Design and write a class named Person and its two subclasses named Student and Employee. Make Lecturer and Admin subclasses of Employee.
A person has a name, address, phone number and email address. A student has a matric number and status (year 1, year 2 or year 3). An employee has a department, salary and date hired.
Define a class named MyDate that contains the fields year, month and day. A lecturer has a rank (Lecturer, Senior Lecturer, Associate Professor or Professor).
An admin staff has a title (Assistant Registrar, Head Registrar or Registrar). Override the toString() method in each class (except MyDate) to display the class name and the personā??s name. Also define a suitable constructor for each class.
Draw the UML diagram for the classes. Write a test program named Asg1_3 that creates an object from each of these classes and invokes their toString() method.
Ads