IPA42
IPA42
firstName - String
lastName - String
age - int
gender - char ('M' for male and 'F' for female)
Create a class Student that extends the Person class and adds the following
attributes:
rollNo - String
course - String
semester - int
GPA - double
Create a class Faculty that extends the Person class and adds the following
attributes:
employeeId - String
department - String
designation - String
salary - double
findHighestGPAStudent method:
This method will take an array of Student objects as input.
The method will return the Student object with the highest GPA.
If the array is empty, the method should return null.
findHighestPaidFaculty method:
This method will take an array of Faculty objects as input.
The method will return the Faculty object with the highest salary.
If the array is empty, the method should return null.
These above mentioned static methods should be called from the main method.
For findHighestGPAStudent method - The main method should print the roll number,
course and GPA of the returned Student object.
If the returned value is null then it should print "Sorry - No student is
available".
For findHighestPaidFaculty method - The main method should print the employee ID,
department and salary of the returned
Faculty object.
If the returned value is null then it should print "Sorry - No faculty is
available".
Before calling these static methods in main, use Scanner object to read the values
of two Student objects and two Faculty
objects referring attributes in the above mentioned attribute sequence.
Example Input:
First1
Last1
20
M
Roll1
Course1
2
3.8
First2
Last2
21
F
Roll2
Course2
3
3.9
Faculty1
Last3
35
M
ID1
Department1
Associate Professor
90000.0
Faculty2
Last4
40
F
ID2
Department2
Professor
100000.0
Output:
Roll2
Course2
3.9
ID2
Department2
100000.0