Question
Java: Please help me with the following coding assignment. thank you. Student Learning Outcomes. creates a class that uses an inheritance use inheritance to call
Java: Please help me with the following coding assignment. thank you.
Student Learning Outcomes.
-
creates a class that uses an inheritance
- use inheritance to call methods of sub and super classes
- Follows standard acceptable programming practices.
- Uses Javadoc commenting on all instance variables and methods
_________________________________________________________________________________________________
- This lab will extend the Student class from Lab 2.
- Write a class called MonitoredStudent
- This class handles a special student who is currently on Academic Probation.
- MonitoredStudent is a subclass of Student.
- The class has 1 Instance variables, an int called minPassingAvg that stores an integer of the minimum average grade required for the student to be removed from Academic Probation.
- Constructor
- Default constructor that sets the instance fields to a default value, remember to pass the appropriate values to the super class.
- Parameterized constructor that sets the instance field to a parameter value, remember to pass the appropriate values to the super class.
- Methods
- setMinPassingAvg - sets or changes the minPassingAvg by taking in a parameter
- getMinPassingAvg - returns the minPassingAvg of the student
- isOffProbation()
- returns true if students quiz average is greater than or equal to the minPassingAvg.
- returns false if students quiz average is lessthan the minPassingAvg.
- Write another class that will test our MonitoredStudent class called MonitoredStudentTester
- Remember since MonitorStudent is also a Student object, you need to prompt from much of the same information as Lab 2.
- Prompt for the minimum Passing average.
- Create a MonitoredStudent object
- As we did in Lab 2: Create a loop that
- Asks user for a quiz score
- Adds that score to the MonitoredStudent object
- Ask the user if they are finished entering scores
- Use the methods of the class to print out the student's name, total score and average quiz score in a nicely formatted output where the score is rounded to 2 decimal place. (Hint use printf)
- Use the methods in the class to print out a message that indicates if the student is off probation.
- Include Javadoc for all classes, method and instance variables
CODE:
public class Student{
//InstanceVariables
/**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;
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started