8. Grade Book A teacher has five students who have taken four tests. The teacher uses…

Need Java code for this assignment.

I am using Eclipse IDE.

Don't use plagiarized sources. Get Your Custom Essay on
8. Grade Book A teacher has five students who have taken four tests. The teacher uses…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay

Ratings will be given to correct responders:

8. Grade Book 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 scores: Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69D 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 set of test scores. The class should have methods that return a specific students name, the average test score, and a letter grade based on the average. 620 Demonstrate the class in a program that allows the user to enter each students name and his or her four test scores. It should then display each students average test score and letter grade. Input Validation: Do not accept test scores less than zero or greater than 100

8. Grade Book 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 scores: Test Score Letter Grade 90–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 student’s set of test scores. The class should have methods that return a specific student’s name, the average test score, and a letter grade based on the average Demonstrate the class in a program that allows the user to enter each student’s name and his or her four test scores. It should then display each student’s average test score and letter grade. Input Validation: Do not accept test scores less than zero or greater than 100.

8. Grade Book 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 scores: Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69D 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 student’s set of test scores. The class should have methods that return a specific student’s name, the average test score, and a letter grade based on the average. 620 Demonstrate the class in a program that allows the user to enter each student’s name and his or her four test scores. It should then display each student’s average test score and letter grade. Input Validation: Do not accept test scores less than zero or greater than 100

Expert Answer

The variables are well named and self explanatory. For indentation please find the attached screenshots.

package gradebook;

import java.io.*;
import java.util.*;

class Student{
String name;
Double[] testScores;
Double avgScore;
Character grade;

Student(String name){
this.name = name;
testScores = new Double[4];

}

public String getName(){
return name;
}

public Double getAvgScore(){
return avgScore;
}

public Character getGrade(){
return grade;
}

public void setScores(Double a,Double b,Double c,Double d){
testScores[0]=a;
testScores[1]=b;
testScores[2]=c;
testScores[3]=d;

avgScore = (a+b+c+d)/4;

if(avgScore<=59 && avgScore>=0){
grade = ‘F’;
}
else if(avgScore<=69){
grade = ‘D’;
}
else if(avgScore<=79){
grade = ‘C’;
}
else if(avgScore<=89){
grade = ‘B’;
}
else if(avgScore<=100){
grade = ‘A’;
}

}

}

class Batch{
ArrayList<Student> studentList;

Batch(){
studentList = new ArrayList<Student>();
}

public void addStudent(Student obj){
studentList.add(obj);
}

public void showRecords(){

for(Student obj:studentList){
System.out.println(obj.getName()+” “+obj.getAvgScore()+” “+obj.getGrade());
}
}
}

public class GradeBook {

public static void main(String[] args) throws IOException {
Batch A = new Batch();
Student obj;
String name;
Double score1,score2,score3,score4;
BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));

for(int i=0;i<5;i++){
System.out.println(“Enter student name “+(i+1));
name = inp.readLine();
System.out.println(“Enter testScore 1”);
score1 = Double.parseDouble(inp.readLine());
while(score1<0 || score1>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 1 again”);
score1 = Double.parseDouble(inp.readLine());
}

System.out.println(“Enter testScore 2”);
score2 = Double.parseDouble(inp.readLine());
while(score2<0 || score2>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 2 again”);
score2 = Double.parseDouble(inp.readLine());
}

System.out.println(“Enter testScore 3”);
score3 = Double.parseDouble(inp.readLine());
while(score3<0 || score3>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 3 again”);
score3 = Double.parseDouble(inp.readLine());
}

System.out.println(“Enter testScore 4”);
score4 = Double.parseDouble(inp.readLine());
while(score4<0 || score4>100){
System.out.println(“Invalid score”);
System.out.println(“Enter testScore 4 again”);
score4 = Double.parseDouble(inp.readLine());
}

obj = new Student(name);
obj.setScores(score1, score2, score3, score4);
A.addStudent(obj);
}

A.showRecords();

}

}

eclipse-workspace gradebook/src/gradebook/GradeBook.java - Eclipse IDE 1, 9(100%) ) 2:26 PM * | Quick Access | :|哈 唸 D GradeBookjava X 2 package gradebook; 4 import java.io. 5 import java.util. 7 class Student String name; Doubletl testScores; Double avgScore; Character grade; 10 12 13 Student (string name) 14 15 16 17 18 19e public String getName) this.name name; testScores -new Doublel4] return name; 21 23e public Double getAvgScore) 24 25 26 27 public Character getGrade) return avgScore return grade; 29 30 31e public void setScores (Double a,Double b,Double c,Double d)t 32 testscores [b]=a; testScores[11-b testscores [21-c testScores [3] d 34 35 36 37 38 39 avgScore(a+b+c+d)/4; if(avgScorec 59 && avgScore>-e){ grade F 41 42 43 else if (avgScore-69) qrade D Writable Smart Insert 135:1

Hope this helps, Please upvote if you feel satisfied.

Thank you 🙂

Top Grade Homework
Order NOW For a 10% Discount!
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents