JAVA.
Write a program to generate test reports for a class of students. The teachers want to easily see which students(s) have the highest test score and to know how the test score of each student compare to the average.
Since you already have a Student class implemented and tested, the TestReporter class can perform input and output and have a reasonable complement of accessor and mutator methods.
TestReporter class should have the following data:
private double highestScore;
private double avaerageScore;
private Student [] ourClass;
private int numberOfStudents; // should be same as ourClass.length.
The job of our program breaks down into these subtasks:
Get ready - draw UML class diagram
Obtain the data
get number of students
create an array of Student, named ourClass
create each student in ourClass
set the name and score for each student
Compute some statistics
find the highest score and average score
Display the results
display the average, the highest score
for each student, compare his/her score to the average
Submission:
TestReporter.java
Student.java (updated)
Run the test reporter with 5 students and verify the results. Submit the screenshot of the console output as MS Words or pdf of the console output.
Previous Code:
import java.util.Scanner;
public class Student {
private String name;
private int score;
public Student() {
}
public Student(String name, int score) {
this.name = name;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public void readInput() {
Scanner sc = new Scanner(System.in);
System.out.print("Enter student name :");
name = sc.nextLine();
System.out.print("Enter score :");
score = sc.nextInt();
}
public void writeOutput() {
System.out.println("Student Name :" + name + ", Score :" + score);
}
}