This is a sub class of a super class and it uses an inheritance. please assist writing the sub class. code for the Super

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

This is a sub class of a super class and it uses an inheritance. please assist writing the sub class. code for the Super

Post by answerhappygod »

This is a sub class of a super class and it uses an inheritance.
please assist writing the sub class.
code for the Super class is posted below the instruction sfor
the subclass
code of the Super class
/**
A student who is taking quizzes.
*/
public class Student
{

/**Student name */
private String name;

/** Total of Quiz Scores */
private double totalScore;

/** Number of Quizzes Taken*/
private int quizCount;


/**
Constructs a student using default
values.
*/
public Student()
{
name = "";
totalScore = 0;
quizCount = 0;
}
/**
Constructs a student with a given name.
@param n the name
*/
public Student(String n)
{
name = n;
totalScore = 0;
quizCount = 0;
}
/**
Sets the student name
@param aName the student's name
*/
public void setName(String aName)
{

name = aName;

}


/**
Gets the name of this student.
@return the name
*/
public String getName()
{
return name;
}
/**
Adds a quiz score.
Test score for valid score (0 >= score
<= 100)
@param the score to add
*/
public void addQuiz(int score)
{
if(score >= 0 && score <=
100)
{
totalScore = totalScore +
score;
quizCount = quizCount + 1;
}
else
{
System.out.println("Score must be
between 0 and 100, inclusive");

}
}
/**
Gets the sum of all quiz scores.
@return the total score
*/
public double getTotalScore()
{
return totalScore;
}
/**
Gets the average of all quiz scores.
@return the average score
*/
public double getAverageScore()
{
return totalScore / quizCount;
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply