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

Write a program that accepts numeric grades of multiple exams for multiple stude

ID: 3725249 • Letter: W

Question

Write a program that accepts numeric grades of multiple exams for multiple students. Then print the followings:
• A table of numeric grades (the numeric grades must be between 0 to 100)
• A table of letter grades
o A if a numeric grade is greater than or equal to 90
o B if a numeric grade is greater than or equal to 80 and less than 90
o C if a numeric grade is greater than or equal to 70 and less than 80
o D if a numeric grade is greater than or equal to 60 and less than 70
o F if a numeric grade is less than 60
• Print the lowest and highest scores among the input
• Print the average score per student
• Print the average score per exam
• Print the sorted average score per student in ascending order. You can use the sorting algorithms (Selection sorting or Insertion sorting) from Chapter 19 or Bubble sorting (https://www.geeksforgeeks.org/bubble-sort/)

Explanation / Answer

import java.util.*;
public class My_score_review {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter no of students:");
int no_of_students=sc.nextInt();
System.out.println("Enter no of exams:");
int no_of_exams=sc.nextInt();
float marks[][]=new float[no_of_students][no_of_exams];
char grades[][]=new char[no_of_students][no_of_exams];
System.out.println("provide the following information:");
for(int i=0;i<no_of_students;i++)
{for(int j=0;j<no_of_exams;j++)
{System.out.println("Enter student "+(i+1)+" marks in exam"+(j+1));
marks[i][j]=sc.nextFloat();
if(marks[i][j]>=90)
grades[i][j]='A';
else if(marks[i][j]<90 && marks[i][j]>=80)
grades[i][j]='B';
else if(marks[i][j]<90 && marks[i][j]>=80)
grades[i][j]='C';
else if(marks[i][j]<80 && marks[i][j]>=70)
grades[i][j]='D';
else if(marks[i][j]<70 && marks[i][j]>=60)
grades[i][j]='E';
else if(marks[i][j]<60)
grades[i][j]='F';
}
}
//part a
System.out.println("Display marks table:");
System.out.print(" ");
for(int i=0;i<no_of_exams;i++)
System.out.print("exam"+(i+1)+" ");
System.out.println();
for(int i=0;i<no_of_students;i++)
{System.out.print("student"+(i+1)+" ");
for(int j=0;j<no_of_exams;j++)
{System.out.print(marks[i][j]+" ");
}System.out.println();
}
//part b
System.out.println("Display grades table:");
System.out.print(" ");
for(int i=0;i<no_of_exams;i++)
System.out.print("exam"+(i+1)+" ");
System.out.println();
for(int i=0;i<no_of_students;i++)
{System.out.print("student"+(i+1)+" ");
for(int j=0;j<no_of_exams;j++)
{System.out.print(grades[i][j]+" ");
}System.out.println();
}
float low=marks[0][0];
float high=marks[0][0];
for(int i=0;i<no_of_students;i++)
for(int j=0;j<no_of_exams;j++)
if(marks[i][j]<low)
low=marks[i][j];
for(int i=0;i<no_of_students;i++)
for(int j=0;j<no_of_exams;j++)
if(marks[i][j]>high)
high=marks[i][j];
//part c
System.out.println("lowest marks among the inputs is:"+low);
//part d
System.out.println("highest marks among the inputs is:"+high);
//part e
float avg[]=new float[no_of_students];

for(int i=0;i<no_of_students;i++)
{avg[i]=0;
for(int j=0;j<no_of_exams;j++)
{ avg[i]+=marks[i][j];
} avg[i]/=no_of_exams;
}
System.out.println(" avg.score of student");
for(int i=0;i<no_of_students;i++)
{System.out.println("Student"+(i+1)+" "+avg[i]);
}
//part f
float avg_exam[]=new float[no_of_exams];

for(int i=0;i<no_of_exams;i++)
{avg_exam[i]=0;
for(int j=0;j<no_of_students;j++)
{ avg_exam[i]+=marks[j][i];
} avg_exam[i]/=no_of_students;
}
System.out.println(" avg.of exams");
for(int i=0;i<no_of_exams;i++)
{System.out.println("exam"+(i+1)+" "+avg_exam[i]);
}
//part g
for (int i=0;i<no_of_students;i++)
{ for (int j =0; j <no_of_students-i-1; j++)
if (avg[j] > avg[j+1])
{
float temp = avg[j];
avg[j] = avg[j+1];
avg[j+1] = temp;
}
}
System.out.println("Sorted avg scores of students");
for (int i=0;i<no_of_students;i++)
System.out.print(avg[i]+" ");

}



}

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