Reply to my peers Peer 1 What medication would you
October 18, 2021
Throughout this course and your psychology program as a whole,
October 18, 2021

Consider the following class: class Student { private String name

 

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.