Code In Java Netbeans
A University wishes to keep information on its students. The proposed Student class has the following instance variables: studentNo: String, studentName: String, dateOfBirth: Date, meritPoints: Integer. Merit Points represents the entry qualification achieved by a student, which is a number between 20 and 200. A class variable is also required, called noOfStudents, which will be incremented each time a Student instance is created. Write Java code to perform the following:
a) Show the declaration of the Student class, including any setter and getter methods. Declare two constructors as follows; both constructors should increment the class variable appropriately: a. The first is a default constructor that has no parameters and sets the instance variables to either "not known" for the strings, 20 for the integer and your date of birth for the date (assume there is a Date constructor that accepts dates in a string format). b. The second takes 4 parameters, one for each of the instance variables.
Q) The Student class is extended by two sub classes Undergraduate with an additional attribute testScore, and Postgraduate with an additional attribute GPA. Both the classes implement a calculateMerit() method that returns the overall merit of the student. The undergraduate merit is calculated by adding the test score to the merit points, while for the postgraduate GPA is added to the merit points. The sub classes’ constructor should invoke the super class’s constructor and the sub classes’ toString method should invoke the super class’s toString method.
A) Create a test class that creates an array of Student variables to store references to various Student objects.
B) Use enhanced for loop to display the content of each object.
C) At run time, add 10 to the total merit of the undergraduate student.