1. Engineering
  2. Computer Science
  3. please follow instructions carefully use java i outputted my student...

Question: please follow instructions carefully use java i outputted my student...

Question details

Please follow instructions carefully. Use java. I outputted my student class below. Thank You!

public class Student {
private static String allStudentNames = "";
private static String topStudent = "unknown";
private static int bestScore = 0;
public static String getClassList() {
if (allStudentNames.equalsIgnoreCase("")) {
return allStudentNames;
} else {
return allStudentNames.substring(0, allStudentNames.length() - 2);
}
}
  
public static String getTopStudent() {
return topStudent;
}
  
private static void setBestStudent(String name, int average) {
if (average > bestScore) {
topStudent = name;
}
}

private String name;
private int test1;
private int test2;
private int test3;

public Student(String name, int t1, int t2, int t3) {
this.name = name;
test1 = t1;
test2 = t2;
test3 = t3;
setBestStudent(name, getAverage());
allStudentNames += name + ", ";
}

public void setName(String input) {
name = input;
}

public String getName() {
return name;
}

public void setScore(int testNumber, int score) {
if (testNumber == 1) {
test1 = score;
} else if (testNumber == 2) {
test2 = score;
} else {
test3 = score;
}
}

public int getScore(int whichTest) {
if (whichTest == 1) {
return test1;
} else if (whichTest == 2) {
return test2;
} else {
return test3;
}
}

public int getAverage() {
int average;
average = (int) Math.round((test1 + test2 + test3) / 3);
return average;
}

public int getHighScore() {
int highScore;
highScore = test1;
if (test2 > highScore)
highScore = test2;
if (test3 > highScore)
highScore = test3;
return highScore;
}

public String toString() {
String phrase = "Name: " + name + " " + "Test 1: " + test1 + " "
+ "Test 2: " + test2 + " " + "Test 3: " + test3 + " "
+ "Average: " + getAverage() + " ";
return phrase;
}
}

Lab: Add/Delete add or delete Write a program called MyClass. This program allows a user to elements (at the end elements. After each addition or deletion, you will display the names of the students in the array. If the array is full, display an error message say the array is full. If the array is empty, display the array is empty when they try to delete. The program should continue to run until the user types quit. of the array) to array of type Student that can hold 20 and averages Requirements: 1. A method called addElement that returns true if the element was successfully added to the array or false if the array is full. The met should take three parameters: a Student array, current size of the array, and the Student being added. hod 2. A method called deleteElement that returns true if the element was successfully deleted from the array (make it equal to null) or false if the array is empty. The method should take 2 parameters: a Student array, and the current size of the array. 3. A method called printArray that has two parameters: a Student array and the current size of the array. The method will output the names of the Students in the array. Submission: Copy and paste your code to a Google document. Upload the document to the classroom.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution