Define a class name Person with the following specifications:
- A private variable name of type String.
- A private variable age of type int.
- A zero-parameterized constructor to initialize all the variables to default.
- A full parameterized constructor to initialize the variables.
- A public method setPerson with 2 parameters String and int to set name and age instance variables.
- A public method toString to return the person data.
Define another class name Student which is extended form Person with the following specifications:
- A private variable gpa of type double.
- A zero-parameterized constructor which calls super class zero-parameter constructor, and also initializes gpa to zero.
- A full parameterized constructor which calls the super class parameterized constructor and initialize all the variables.
- A setter and getter method for gpa variable.
- A public method toString to return the student data, this method should call the toString method from the supper class.
Define a Java class Test that contains a main method and test the functionality of the above classes as the following:
- Define an array S of type Student with size 2.
- In the first element of the array S:
- instantiate an object of type Student using zero-parameterized constructor.
- change the name of that object to "Ahmed" and the age to 19 using setPerson method.
- Ask the user to enter a student gpa and store it in that object.
- In the second element of the array S, instantiate an object of type Student using full parametrized constructor with these information: