Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m having trouble with this Assignment : A teacher has five students who have

ID: 3693149 • Letter: I

Question

I'm having trouble with this Assignment : 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: A=90-100 B=80-89 C=70-79 D= 60-69 F = 0-59 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, average test score, and a letter grade based on the average. Demonstrate the calss in a program that allows the user to enter each students name and his or her four test scores. It should display each students average test score and letter grade. Do not accept test scores less than zero or greater than 100.

Here is what I have so far:

For the demo:

Explanation / Answer

Ans;

// THE PROGRAM WORKS FINE ON MY SYSTEM PLZ TELL IF U HAVE ANY BUGS WHILE RUNNING IT

// IT IS WRITTEN USING SIMPLE TECHNIQUES EASY TO UNDERSTAND


import java.util.Scanner;
class Gradecalculator
{
static String [] names=new String[5];
static char [] grades=new char[5];
static double [][] testscore=new double[5][4];
protected char[] calculate(double [][] testscore)
{
double total[]=new double[5];
for(int i=0;i<5;i++)   
{
for(int j=0;j<4;j++)
{
total[i]=0;

  
}
}
for(int i=0;i<5;i++)   
{
for(int j=0;j<4;j++)
{

total[i]=total[i]+testscore[i][j];
  
}
}
for(int i=0;i<5;i++)
{
total[i]=total[i]/4;
}
for(int i=0;i<5;i++)
{
if(total[i]>=90&&total[i]<=100)
grades[i]='A';
else if(total[i]>=80&&total[i]<90)
grades[i]='B';
else if(total[i]>=70&&total[i]<80)
grades[i]='C';
else if(total[i]>=60&&total[i]<70)
grades[i]='D';
else
grades[i]='F';
}
return(grades);
}
  
}

public class Grade extends Gradecalculator {
  
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
Grade ob=new Grade();
System.out.println("enter the name of students");
for(int i=0;i<5;i++)
{
System.out.println((i+1)+"student");
names[i]= sc.nextLine();
}
System.out.println("enter the test scores of students");
for(int i=0;i<5;i++)
{
System.out.println("STUDENT "+(i+1));
for(int j=0;j<4;j++)
{
System.out.println("TEST "+(j+1));
testscore[i][j]=sc.nextDouble();
if(testscore[i][j]>100)
{
System.out.println("in appropriate value TRY AGAIN");
j--;
continue;
}
}
}
System.out.println("OK INPUT COMPLETE WANT TO KNOW THE FULL RESULTS Y/N");
String resp=sc.next();
  
ob.calculate(testscore);
if(resp.equals("Y"))
{
System.out.println("------------DISPLAYING RESULTS-----------") ;
System.out.println("STUDENT NAME GRADES");
for(int i=0;i<5;i++)
{
System.out.println(names[i]+" "+grades[i]);
}
  
System.out.println("want to check individual scores enter the student number");
int n=sc.nextInt();
try
{
System.out.println("STUDENT NAME "+names[n-1]+" GRADES "+grades[n-1]);
System.out.println("INDIVIDUAL TEST SCORES");
for(int i=0;i<4;i++)
{
System.out.println(testscore[n-1][i]);
}
}
catch(Exception e)
{
System.out.println("this student does not exist");
}
  
}
else
{
System.out.println("CLOSING");
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote