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

Code needs to be written in java. I would like a program that will calculate eac

ID: 3715117 • Letter: C

Question

Code needs to be written in java.

I would like a program that will calculate each student’s average grade for multiple classes. The number of students and the number of classes is unknown. The program should be able to calculates the class average. The program should give me the students id #, average, and letter grade. It should give me the class average and the percentage of students who received a C or better and the number of students who earned the class average or above.   I need to know the class median, range, highest and lowest scores. The department will be giving a small scholarship to students who earn an 87.5 or higher in the course. The scholarship will be calculated by multiplying their average by 2.75.

More technical description:

Prompt the professor to enter data for one student at a time including student ID and grades for each student. Prompt the user to enter -1 to show that the user is through entering grades. If the score entered is less than 0 or more than 100, display an appropriate message and do not use the score. After all scores have been entered, display the number of scores, entered, the highest score, the lowest score, and the mean. You should have multiple methods and an array at minimum.

Explanation / Answer

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

public class Demo152{

    public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
       int count = 0;
       int[] ID = new int[100];
       double[][] grade = new double[100][20];
       double[] avg = new double[100];
       int[] size = new int[100];
       String[] finalgrade = new String[100];
       double[] Max = new double[100];
       double[] Min = new double[100];      
       while(true){
           System.out.println("Enter id:");
           int a = Integer.parseInt(sc.nextLine());
           if (a == -1)
              break;
           ID[count] = a;
           System.out.println("Enter scores (-1) to stop:");
           String scores = sc.nextLine();
           String[] list = scores.split(" ");
           int count1 = 0;
           while (true){
              int b = Integer.parseInt(list[count1]);
              if (b == -1)
                 break;
              if (b >= 0 && b <= 100) {
                 grade[count][count1] = b;
                 count1++;
              }
              else {
                 System.out.println("Error:Score should be between 0 and 100");
              }                    
           }
           size[count] = count1;
           count++;
       }
      
       int countC = 0;
       for (int i = 0; i<count; i++){
            double sum = 0;
            Max[i] = grade[i][0];
            Min[i] = grade[i][0];
            for (int j = 0; j<size[i]; j++){
                sum = sum + grade[i][j];
                if (grade[i][j] > Max[i])
                   Max[i] = grade[i][j];
                if (grade[i][j] < Min[i])
                   Min[i] = grade[i][j];

            }
            avg[i] = sum / size[i];
            if (avg[i] >=89)
               finalgrade[i] = "A";
            else if (avg[i] >=79)
               finalgrade[i] = "B";
            else if (avg[i] >=69)
               finalgrade[i] = "C";
            else if (avg[i] >=60)
               finalgrade[i] = "D";
            else
               finalgrade[i] = "F";

            if (avg[i] >= 69)
               countC++;
       }

       for (int i = 0; i<count; i++){
           System.out.print(ID[i] + " ");
           for (int j = 0; j<size[i]; j++)
               System.out.print(grade[i][j] + " ");
           System.out.print(Double.toString(avg[i]) + " " + Double.toString(Max[i]) + " " + Double.toString(Min[i]) + " " + finalgrade[i]);
           System.out.println();
       }
       double sum = 0;
       for (int i = 0; i<count; i++)
           sum = sum + avg[i];

       double classavg = sum/count;
       int countAbove = 0;
       int countBelow = 0;
       for (int i = 0; i<count; i++){
           if (avg[i] > classavg)
              countAbove++;
           if (avg[i] < classavg)
              countBelow++;

       }


       System.out.println("Class Average:" + Double.toString(classavg));
       System.out.println("% of studenst getting C or better:" + Double.toString((countC/count) * 100.0));
       System.out.println("% of studenst above avg:" + Double.toString((countAbove/count) * 100.0));
       System.out.println("% of studenst below avg:" + Double.toString((countBelow/count) * 100.0));
     
    }
}

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