Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package javaapplication 9 5 ; import java.util.Scanner; public class GradeCategorization { public static void main ( String [ ] args ) { Scanner scanner =
package javaapplication;
import java.util.Scanner;
public class GradeCategorization
public static void mainString args
Scanner scanner new ScannerSystemin;
int grades new int; Array to store grades for students in courses
Input grades for Math
System.out.printlnEnter the degree of the ten students for Math separated by space:";
for int i ; i ; i
gradesi scanner.nextInt;
Input grades for Science
System.out.printlnEnter the degree of the ten students for Science separated by space:";
for int i ; i ; i
gradesi scanner.nextInt;
Input grades for English
System.out.printlnEnter the degree of the ten students for English separated by space:";
for int i ; i ; i
gradesi scanner.nextInt;
scanner.close;
int degreeCount new int; Array to count students in each degree for each course
Categorize grades and count students in each degree for each course
for int i ; i ; i
for int j ; j ; j
if gradesij && gradesij
degreeCounti;
else if gradesij && gradesij
degreeCounti;
else if gradesij && gradesij
degreeCounti;
else if gradesij && gradesij
degreeCounti;
else
degreeCounti;
Display the number of students in each degree for each course
System.out.println Grade Math Science English ;
System.out.println;
for int i ; i ; i
System.out.printfs d d d
getGradeLabeli
degreeCounti
degreeCounti
degreeCounti;
Calculate and display success rate in percentage for each course
int totalStudents ;
int successCount new int;
for int i ; i ; i
successCounti totalStudents degreeCounti; Total students minus F grades
int successRate new int;
for int i ; i ; i
successRateisuccessCounti totalStudents;
System.out.println Success Rate successRate successRate successRate;
Helper method to get the grade label based on index
private static String getGradeLabelint index
switch index
case :
return A;
case :
return B;
case :
return C;
case :
return D;
default:
return F;
Step 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