Question: Write a program to create a Student class with variables id , and name. Include methods getStudent ( ) and showStudent ( ) in the
Write a program to create a Student class with variables id and name. Include methods getStudent and showStudent in the class. Create another class named Graduate, which is a child of the Student class. Include a member variable degree, and methods getGraduate and showGraduate in the class.
Finally, create a third class named PhD which is a child of the Graduate class. Include a variable thesisTitle, and methods getPhD and showPhD in the class.
The Java program should consist of:
Set and get methods for all attributes in the class
A constructor for the class
Methods as mentioned above
Passing of appropriate parametersarguments in methodsfunctions where necessary
Create a Main class with the static void mainString args that will run the program as follows:
a Read the lines from the file StudentDatatxt
i Split each line where there exists a comma and store it in an array
ii Breakdown the data into sub parts
b Create another array named as PhDRequirement that contains the elements
BScBA MSc MA MPhil
c Traverse through the PhDRequirement array
i Check if the element in PhDRequirement array equals the data Student
Degree in the array created in a above, and if yes
I should create an object of the PhD class, read and display their
details in Java Console as per the format given in the screenshot. Hint: Only if condition, NO else part Note that, only those data from the text files that has BSc BA MSc Sample data of the "StudentData.txt file
Expected OutputMA, MPhil as Degree requirement are displayed while others are
ignored.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
