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

Requesting help here on a tough assignment. The ask is to create a java program

ID: 651651 • Letter: R

Question

Requesting help here on a tough assignment. The ask is to create a java program that will take two arguments: the first is the input file name, the second is the output file name. The input file will have a list of written grades and student names and the idea is to compute a weighted average of the score and assign a letter grade for each student in alphabetical order. Simultaneously the program should output the average scores of all the students, the maximum and the minimum for each assignment in a console like:

C:>java my_program input_data.txt output_data.txt

Letter grade has been calculated for students listed in input file input_data.txt and written to output file output_data.txt

Here is the class averages:

Q1 Q2 Q3 Q4 MidI MidII Final

Average: 82.25 80.38 82.25 83.88 81.38 84.13 78.63

Minimum: 60 54 38 62 62 60 50

Maximum: 100 90 100 100 99 100 95

Press ENTER to continue . . .

QUESTION - How can you retrieve the minimum and maximum values, and show them for each assignment group? i.e. In Q1 column the min is 60 and the max is 100

Below is the image of the input file. Thanks!

input_hw11.txt hui Bhu, 100, 90, 80, 100, 89, 99, 88 Ariana B. Smith, 90, 90, 100, 100, 99, 100, 95 Emily Gonzales, 100, 9«, 100, 7«, 78, 78, 80 Jennifer L, 80, 90, 90, 100, 89, 99, 85 Maria Jones, 65, 72, 77, 68, 62, 70, 65 Bill Gates, 60, 54, 38, 62, 65, 60, 50 Escobar Morris, 83, 77, 88, 76, 79, 72, 76 Anne Latner, 80, 80, 85, 95, 90, 95, 90

Explanation / Answer

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

class student implements Comparable<student>{
   String name;
   float percentage;
   public student(String n,float per){
       name = n;
       percentage = per;
   }
   @Override
   public int compareTo(student o) {
       return this.name.compareTo(o.name);
   }
}

class main{
   public static void main(String args[]) throws IOException{
       BufferedReader filereader1=new BufferedReader(new FileReader(args[0]));
       int len = 0;
       String ss = filereader1.readLine();
       while (ss != null){
           len++;
           ss = filereader1.readLine();
       }
       BufferedReader filereader=new BufferedReader(new FileReader(args[0]));
       String b = filereader.readLine();
       String[] l = b.split(", ");
       int j = 1;
       float[] avg = new float[l.length-1];
       int[] min = new int[l.length-1];
       int[] max = new int[l.length-1];
       float sum = 0;
       student[] std = new student[len];
       for (int i = 1; i < l.length; i++){
           avg[i-1] = Float.parseFloat(l[i]);
           min[i-1] = Integer.parseInt(l[i]);
           max[i-1] = Integer.parseInt(l[i]);
           sum += Integer.parseInt(l[i]);
       }
       student st = new student(l[0],sum/(l.length-1));
       std[j-1] = st;
       b = filereader.readLine();
       while (b!=null){
           l = b.split(", ");
           sum = 0;
           for (int i = 1; i < l.length; i++){
               avg[i-1] = (avg[i-1]*j + Float.parseFloat(l[i]))/(j+1);
               int k = Integer.parseInt(l[i]);
               sum += k;
               if (k < min[i-1])
                   min[i-1] = k;
               if (k > max[i-1])
                   max[i-1] = k;
           }
           j += 1;
           st = new student(l[0],sum/(l.length-1));
           std[j-1] = st;
           b = filereader.readLine();
       }
       filereader.close();
       System.out.println("Here is the class averages: ");
       System.out.println("Q1 Q2 Q3 Q4 MidI MidII Final");
       System.out.print("Average: ");
       for (int i = 0; i < avg.length; i++){
           System.out.print(avg[i]+" ");
       }
       System.out.print(" Minimum: ");
       for (int i = 0; i < min.length; i++){
           System.out.print(min[i]+" ");
       }
       System.out.print(" Maximum: ");
       for (int i = 0; i < max.length; i++){
           System.out.print(max[i]+" ");
       }
       System.out.println(" Press ENTER to continue . . . ");
       FileWriter sd=new FileWriter(args[1]);
       Arrays.sort(std);
       for (int i = 0; i < std.length; i++){
           sd.write(std[i].name+" ");
           if (std[i].percentage > 90)
               sd.write("A ");
           else if (std[i].percentage > 80)
               sd.write("B ");
           else if (std[i].percentage > 70)
               sd.write("C ");
           else if (std[i].percentage > 60)
               sd.write("D ");
           else
               sd.write("F ");
       }
       sd.close();
   }
}

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