Question
JAVA- class StudentGrade { private String name; double score; public Person(String name, double score) { this.name = name; this.score = score; } public String toString()
JAVA-
class StudentGrade
{
private String name;
double score;
public Person(String name, double score)
{
this.name = name;
this.score = score;
}
public String toString()
{
String res = "Name: " + name + " ";
res += "Score: " + score + " ";
return res;
}
public String getName()
{
return name;
}
public double getScore()
{
return score;
}
}
class GradeArray
{
}
public class Homework1
{
public static void main(String[] args)
{
int maxSize = 100;
String courseID = "CS116";
GradeArray grades = new GradeArray(maxSize, courseID);
grades.insert("Evans", 78);
grades.insert("Smith", 77);
grades.insert("Yee", 83);
grades.insert("Adams", 63);
grades.insert("Hashimoto", 91);
grades.insert("Stimson", 89);
grades.insert("Velasquez", 72);
grades.insert("Lamarque", 74);
grades.insert("Vang", 52);
grades.insert("Creswell", 88);
// print grade summary: course ID, average, how many A, B, C, D and
Fs
System.out.println(grades);
String searchKey = "Stimson"; // search for item
StudentGrade found = grades.find(searchKey);
if (found != null) {
System.out.print("Found ");
System.out.print(found);
}
else
System.out.println("Can't find " + searchKey);
// Find average and standard deviation
System.out.println("Grade Average: " + grades.avg());
System.out.println("Standard dev; " + grades.std());
// Show student grades sorted by name and sorted by grade
grades.reportGrades(); // sorted by name
grades.reportGradesSorted(); // sorted by grade
System.out.println("Deleting Smith, Yee, and Creswell");
grades.delete("Smith"); // delete 3 items
grades.delete("Yee");
grades.delete("Creswell");
System.out.println(grades); // display the course summary again
}
}
Complete the GradeArray class by implementing the following features: 1. Constructor of GradeArray 2. The insert0, delete0, and find0 methods. Sequential search is OK 3. The argo and stdO methods for calculating the average and standard deviation of the grade data. Use the following formula: The toString0 methods for displaying the grade summary: Show the course ID, grade average, and how many A, B, C, D, and Fs are given 4. Use the following grading scheme: A for 90 or above, B for 80 to 89,. for below 60 5. The reportGrades0 method for displaying students' grades sorted by student name, and the reportGradesSorted0 method for displaying students' grades sorted by gradeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started