Question: I need help in this Assignment Sirs thanks :) Extending Student Record. The StudentRecord class is given for your reference. The following are your tasks:

I need help in this Assignment Sirs thanks :)

Extending Student Record.

The StudentRecord class is given for your reference. The following are your tasks:

Overload the StudentRecord constructor with one that accepts 4 parameters namely the name, mathGrade, englishGrade and scienceGrade.

Create a class that will inherit the attributes and methods of the StudentRecord class and name it ComputerScienceStudentRecord. Use the extends keyword for inheritance.

The ComputerScienceStudentRecord class will only have a comprogGrade attribute of double data type. Its constructor should accept 5 parameters namely the name, mathGrade, englishGrade, scienceGrade and comprogGrade.

Inside the ComputerScienceStudentRecord constructor, use the super keyword to call on the constructor of the StudentRecord and be able to assign the first 4 parameters. The value of the last parameter will be assigned to comprogGrade.

Override the computeAverageGrade method of the StudentRecord class in the ComputerScienceStudentRecord class. The result should be the average grade from the 4 subjects, Math, English, Science and Computer Programming.

Create a class that would contain the main method and name it Lab8Main. In the main method, instantiate a ComputerScienceStudentRecord object that has 5 parameters. The sample output is shown below.

public class StudentRecord { //these are the attributes private String name; private double mathGrade; private double englishGrade; private double scienceGrade; //this is the constructor public StudentRecord(){ this.name=""; this.mathGrade=0; this.englishGrade=0; this.scienceGrade=0; }

//these are the mutators and accessors public String getName() { return name; }

public void setName(String name) { this.name = name; }

public double getMathGrade() { return mathGrade; }

public void setMathGrade(double mathGrade) { this.mathGrade = mathGrade; }

public double getEnglishGrade() { return englishGrade; }

public void setEnglishGrade(double englishGrade) { this.englishGrade = englishGrade; } public double getScienceGrade() { return scienceGrade; } public void setScienceGrade(double scienceGrade) { this.scienceGrade = scienceGrade; } //custom method public double computeAverageGrade(){ return (this.mathGrade + this.englishGrade + this.scienceGrade)/3; } }

Sample Output:

run:

Name: Anna Manna

Math: 71.23

English:82.34

Science:93.45

Computer Proggraming:95.67

AVERAGE GRADE:85.67

BUILD SUCCESSFUL (total time: 0 seconds

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!