00:01
In this question, we have to solve a question in java that we have to write a program in java.
00:06
So let us see the approach that we will use here.
00:10
So this program will define two classes.
00:16
As you can see, person and applicant.
00:29
These are the two classes.
00:31
Then the person class, as you can see here, it represents the name and the last name of an applicant.
00:41
And the applicant class extends person and adds the applicant id as a new attribute in it.
00:51
So it also implements the comparable interface to enable sorting of applications based on their final score.
01:00
So now this program will include a test class that will contain sort and print methods.
01:15
So we will be using these methods that is the sort that takes an array of objects that implements the comparable interface and will sort them into ascending or descending order.
01:30
And the print method will print each object in the array to its two string method.
01:36
So in the main method that is there, a simple array of applicant objects that are there is created and stored in the applicants array.
01:47
Then the sort method is called with true to the sort the applicants in the descending order.
01:58
Finally, it is printed to display the sorted list.
02:01
So let us see a program in java, how we are going to solve this.
02:08
For that, i'm using a basic compiler.
02:11
So first we'll do is we'll import the necessary files that are there.
02:18
Then we will start by defining two classes that is person and applicant.
02:26
First we will do is we'll import the person class as you can see here.
02:34
So the person class represents the name and the last name of the applicant while the applicant class will extend the person class and add the applicant id as the attribute.
02:49
So this inheritance allows the applicant object to have access to the name and last name attributes that are defined in the person class as you can see.
02:59
So then it will return these that are there.
03:03
Now we will see at the applicant class that we will define.
03:11
So next is the applicant class.
03:15
So here applicant class implements the comparable interface which allows the object of this class to be compared and sorted.
03:25
Now the comparable interface requires implementing the compareto method which is used to define the comparison logic that is there.
03:37
So also you can see that in the applicant class several constants are defined to represent the minimum and maximum values for gpa.
03:53
So that we can see here and these are for gpa and interview scores.
04:01
So these constants are used in the mapping process to bring the gpa and interview scores to a common scale that is 0 to 100.
04:11
So that we have to give a public applicant class like this.
04:17
Now next thing we are going to do is we are going to return all the interview score and this and that score whichever we just wrote here.
04:32
So for that we will use each class return function.
04:42
So we will use this entire function like this which will return each applicant undergraduate score then get exams.
04:54
It will get input from the user and then return it...