You are on page 1of 1

Draw an inheritance hierarchy for students at a university.

Use Student as the superdass of the


hierarchy, then extend Student with classes Undergraduate Student and Graduate Student Continue to
extend the hierarchy as deep pe as muny levels) as possible For example, Freshman Sophomore, Junior
and Senior might extend Undergraduate Student, and DoctoralStudent and MastersStudent might be
subclasses of GraduatéStudent After drawing the hierarchy. i. Discuss the relationships that exist
between the classes (10 marks) Write java code for the inheritance hierarchy for students at the
university (15 marks) QUESTION 3 [25 marks] #include <iostream, h) Struct dala a) A hospital wants to
create a database regarding its indoor patients. The information to store include -Name of the patient
int d int m Age of the patient - Disease Date of admission Class hospital -Date of discharge Create a class
called Patient to store the above nformation. The member methods should include methods to enter
information and display the patient's information(5 marks). Such date Create class Date to have the date
(year, month and day as its fields) and a method to display the Structure date date. (5 marks) Create
c'ass Hospital to have an array list to store all patients. It has methods to add a patient to the list and to
delete a patient from the list. It also has a method to display a list of all the patients in the hospital and a
method to display only the patients whose age is less than 12. (10 marks) o) What might go wrong with
the following code, what would you need to do to fix it. (2 marks) public class Test { int x; int y; public
Test (int x, int y) { c) Write a method that generates 100 integer random numbers between 0 and 10 and
counts the even numbers from those generated numbers. (3 marks) QUESTION 4 [25 marks]

You might also like