Construct a Java class named CscStudent which inherits from

) Construct a Java class named CscStudent which inherits from (i.e. extends) the Student class presented below. Your new class should add the additional private data members of a String named advisor and a double named average. Write a constructor for your class which takes 3 strings and a double. The first two strings should be passed to the super class constructor to be assigned properly. The third String should be assigned into the advisor field and the final double value should be assigned into the average field.

public class Student {

private String name;

private String ssnum;

public student ( String nm, String ss ) {

name = nm;

ssnum = ss;

}

}

Solution

CscStudent.java


public class CscStudent extends Student{
   private String advisor;
   private double average;
   public CscStudent(String name, String ssnum, String advisor, double average){
       super(name, ssnum);
       this.advisor = advisor;
       this.average = average;
   }
}

Student.java

public class Student {

private String name;

private String ssnum;

public Student ( String nm, String ss ) {

name = nm;

ssnum = ss;

}

}

) Construct a Java class named CscStudent which inherits from (i.e. extends) the Student class presented below. Your new class should add the additional private

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site