Hi - Requesting help here on a tough assignment. The ask is to create a java pro
ID: 672068 • Letter: H
Question
Hi - 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 (See attached) 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. Here's the output in the output file:
Anne Latner: B
Ariana B. Smith: A
Bill Gates: F
Emily Gonzales: B
Escobar Morris: C
Jennifer L: B
Maria Jones: D
Thui Bhu: A
and the console output would be the following:
C:>java TestLetterGrader 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 . . .
I do know how to ask for two inputs from the user via eclipse (IDE) or command line and output strings into the output file and also use a series of system.out.print commands to print to the screen. Figuring out how to calculate the weighted average of the numbers and also assigning the grade is not a problem.
What I don't know are the following:
1 - How to alphabetically rearrange the student's names to display the grade instead of the order in which they are read from the input file.
2 - How to retrieve and show the min and max value for each assignment in the group? i.e. In Q1 column the min is 60 and the max is 100
Below is the image of the input file. Help with some code samples on the two above scenarios if possible will be greatly appreciated. Thanks!
Explanation / Answer
import java.util.*; import java.io.*; import java.text.*; public class StudentGradebookScores { public static void main(String[]args) throws IOException { File inputFile = new File("scores.txt"); Scanner data = new Scanner(inputFile); DecimalFormat averages = new DecimalFormat("#.#"); int students = data.nextInt(); int assignments = data.nextInt(); double gradebook[][] = new double [students + 1][assignments + 1]; //putting the scores into the array for (int i=0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.