Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7*****Help with JAVA, noob when it comes to this, please explain and show OUTPUT PLEASE!!******** Implement aclass Student. For the purpose of this exercise, a

7*****Help with JAVA, noob when it comes to this, please explain and show OUTPUT PLEASE!!********

Implement aclass Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods getName(), addQuiz(int score), getTotalScore(), and getAverageScore(). To compute the latter, you also need to store the number of quizzes that student took.

1. Use the Lab7StudentTester class (Lab7StudentTester.java) to test your Student class. The StudentTester class produces the following output:

image text in transcribed

2.After completing part 1, add the following instance methods to the Student class.

a. getHighestScore returns the highest quiz score. Returns Integer.MIN_VALUE if there are no quiz scores.

b. getLowestScore returns the lowest quiz score. Returns Integer.MAX_VALUE if there are no quiz scores

c. getScores returns an int array (int[]) that contains the quiz scores is ascending order. The array length is the number of quiz scores. Returns a zero length int array if there are no quiz scores.

d. toString returns a string that contains the student name, the number of quizzes, and each quiz score.

3. After completing part 2, modify the Lab7StudentTester class to test the new Student class methods.

HERE'S the Code:

import java.util.Arrays; /** * Lab7 * This is a tester for the Student class. */ public class Lab7StudentTester { public static void main(String[] args) { test(1, "Jane", new int[] { 80, 90, 85, 100}); int[] testData2 = {75, 93, 88, 84, 91, 80, 78}; test(2, "Bill", testData2); } private static void test(int testNum, String name, int[] quizzes) { System.out.printf("Test %d%n", testNum); System.out.printf(" Inputs: name = \"%s\" quizzes = %s%n", name, Arrays.toString(quizzes)); Student student = new Student(name); for(int quiz : quizzes) { student.addQuiz(quiz); } int quizTotal = student.getTotalScore(); int quizAvg = student.getAverageScore(); String studentName = student.getName(); System.out.printf( " Outputs: name = \"%s\" quiz total = %d quiz avg = %d%n", studentName, quizTotal, quizAvg); System.out.println(); } } 

run Test 1 Inputs name "Jane" quizzes [80, 90, 85, 100 Outputs name Jane quiz total 355 quiz avg 88 Test 2 Inputs name Bil quizzes [75 93 88, 84, 91, 80, 78] Outputs name Bi quiz total 589 quiz avg 84 BUILD SUCCESSFUL (total time 0 seconds

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

Students also viewed these Databases questions

Question

how would you place 314.159 * 10^(3 )into scientific notation

Answered: 1 week ago

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago

Question

When would you use one approach, and when would you use another?

Answered: 1 week ago