Consider the following class: class Student { private String name ; ?? public void setName ( String n) { ???????
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →
Consider the following class:
class Student {
private String name ;
public void setName ( String n) {
name = n; }
public String getName () {
return name ; }
public Student ( String n) {
setName (n); }
}
(a) ( 8 marks ) Extend class Student to class ResearchStudent by adding a data member gpa (standing for grade point average). Marks will be awarded based on correctness of class header, data member and type, getter and setter and parameterized constructor using super keyword.
(b) (2 marks) Declare a Student object referenced be myStudent and use run-time polymorphism with ResearchStudent whose name is "Robin", gpa is 3.
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds