Question: Write a class called Student. The specification for a Student is: Three Instance fields name - a String of the student's full name totalQuizScore -

Write a class called Student. The specification for a Student is:

Three Instance fields

name - a String of the student's full name

totalQuizScore - double

numQuizesTaken - int

Constructor

Default construtor that sets the instance fields to a default value

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

Methods

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

getName - returns the name of the student

getAverageScore - calculates and returns the average quiz score.

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.

getTotalQuizScore - returns the totalQuizScore .

Write another class that will test our Student class.

Ask the user for Student name

Creates a Student object with that name

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

Use the methods of the class to print out the student's name, total score and average quiz score in a nicely formated output where the score is rounded to 2 decimal place.

Create new student object using the default constructor.

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

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

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!