1. Engineering
  2. Computer Science
  3. java please help with the following assignment i started writing...

Question: java please help with the following assignment i started writing...

Question details

Java: Please help with the following assignment. I started writing what I think should go there, but would greatly appreciate some guidance. Thanks.

  1. Write a class called Student.
  2. The class has 3 Instance variables
  3. name - a String of the student's full name --> private String name;
    1. totalQuizScore - double--> private double totalQuizScore;
    2. numQuizesTaken - int --> private int numQuizesTaken;
  4. Constructor
    1. Default constructor that sets the instance fields to a default value-->

public Student ()

{

name = " ";

totalQuizScore = new totalQuiz Score();

numQuizesTaken = new numQuizesTaken();

}

  1. Parameterized constructor that sets the name instance field to a parameter value and set the other instance fields to a default value. -->

public Student(String name)

{

this.name = name;

this.totalQuizScore = totalQui

}

  1. Methods

  1. setName - sets or changes the student name by taking in a parameter

-->public void setName(){

}

  1. getName - returns the name of the student

--> public String getName()

{

}

  1. getAverageScore - calculates and returns the average quiz score.

--> public int getAverageScore

{

}

  1. addQuiz
    • takes in a score parameter (int)
    • If the score parameter is not within the range of a score (0 >= score <= 100) Display an error message and ignore that score.
    • adds that score to totalQuizScore
    • increments the numQuizesTaken field.

  1. getTotalQuizScore - returns the totalQuizScore .

  1. Write another class that will test our Student class called StudentTester

--public class StudentTester()

  1. Prompts the user for Student name(Hint: Scanner next() method)

  1. Creates a Student object with that name

  1. Create a loop that
    • Asks user for a quiz score
    • Adds that score to the Student object
    • Ask the user if they are finished entering scores

  1. 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)

  1. Create new student object using the default constructor.

  1. Use the appropriate method to set the new Student object student name.

  1. Use the appropriate method to print out the new student's name.

  1. Include Javadoc for all classes, method and instance variables
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution