Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

  1. creates a class that uses an inheritance

  2. use inheritance to call methods of sub and super classes
  3. Follows standard acceptable programming practices.
  4. Uses Javadoc commenting on all instance variables and methods

_________________________________________________________________________________________________

  1. This lab will extend the Student class from Lab 2.
  2. Write a class called MonitoredStudent
    1. This class handles a special student who is currently on Academic Probation.
    2. MonitoredStudent is a subclass of Student.
    3. 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.
    4. Constructor
      1. Default constructor that sets the instance fields to a default value, remember to pass the appropriate values to the super class.
      2. Parameterized constructor that sets the instance field to a parameter value, remember to pass the appropriate values to the super class.
    5. Methods
      1. setMinPassingAvg - sets or changes the minPassingAvg by taking in a parameter
      2. getMinPassingAvg - returns the minPassingAvg of the student
      3. isOffProbation()
        1. returns true if students quiz average is greater than or equal to the minPassingAvg.
        2. returns false if students quiz average is lessthan the minPassingAvg.
  3. Write another class that will test our MonitoredStudent class called MonitoredStudentTester
    1. Remember since MonitorStudent is also a Student object, you need to prompt from much of the same information as Lab 2.
    2. Prompt for the minimum Passing average.
    3. Create a MonitoredStudent object
    4. As we did in Lab 2: Create a loop that
      1. Asks user for a quiz score
      2. Adds that score to the MonitoredStudent object
      3. Ask the user if they are finished entering scores
    5. 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)
    6. Use the methods in the class to print out a message that indicates if the student is off probation.
  4. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

HOW is the outcome to be measured and verified.

Answered: 1 week ago

Question

Describe employee assistance programs.

Answered: 1 week ago

Question

Describe the importance of physical fitness programs.

Answered: 1 week ago

Question

Discuss the factors that set the stage for global HR practice.

Answered: 1 week ago