A teacher has five students who have taken four tests. The Teacher uses the foll
ID: 3621475 • Letter: A
Question
A teacher has five students who have taken four tests. The Teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
Write a class that uses a String array or an ArrayList object to hold the five students names, an array of five characters to hold the five students' letter grades, and five arrays of four doubles each to hold each students name, average test score, and a letter grade based on the average. Demostrate the class in a program that allows the user to enter each students name and his or her four test scores. It shuld then display each stuenddts average test score and letter grade
Modify the grage book application so that it drops each students lowest score when determing the test scre averages and letter grades.
Explanation / Answer
Dear... public class Student { private String name; private double[] test = new double[4]; public Student() { name = " "; } public Student(String n, double[] t) { name = n; test = t; } public void setName(String n) { name = n; } public String getName() { return name; } public void setTest(double t,int i) { test[i] = t; } public double getTest(int i) { return test[i]; } public double getTestAvg() { double sum = 0; double avg; for(int i = 0; i = 90) grade = 'A'; else if (average >= 80) grade = 'B'; else if (average >= 70) grade = 'C'; else if (average >=60) grade = 'D'; else if (average < 60) grade = 'F'; return grade; } public String toString() { String str = ""; str += " Name of student: " + name; str += " Average test score: " + getTestAvg(); str += " Letter grade: " + getLetterGrade(); return str; } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.