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

Write a program that creates a file containing a table showing the student ID nu

ID: 3635017 • Letter: W

Question

Write a program that creates a file containing a table showing the student ID numbers and averages of
all the students in a course in ascending order by ID number. The input to the program is a file
containing student records. Each student record consists of a student’s first name, a student’s last name,
a student’s ID number, and the student’s average. Each of the fields of the record is separated by a
newline character and there is one newline character separating one student’s record from the next
record in the file. Each student’s ID number has the following form LDD-DDDDD. L is the letter B,
M, or P and the D’s are digits. You may assume that the data was validated before it was put in the file.
You may assume that there will not be more than one hundred student records in the input file.
Your program must allow the user to enter the names of both the input file and the output file.
Create a system of parallel arrays to store the data needed from the file. One array should store the
student’s ID numbers and one array should store the student’s averages. The arrays should be related by
the subscripts. The first student’s ID number is in the student ID array at subscript 0 and the student’s
average is the averages array at subscript 0.
Your program must consist of at least four meaningful methods. For example, you might create a
method to read the input file and store the necessary data in your arrays, another method that performs
the sort, and another method that writes the data from the arrays to the output file (your fourth method
would be your main method). Create additional methods as you find necessary. You must pass data
between the methods using arguments and parameters. You may not declare any variables globally
(outside of the methods). There must be a paragraph of comments before each of your methods that
describes what the method does and what inputs it receives and outputs it returns.
Modify the selection sort algorithm provided in the text to perform the sort. When you sort the data in
your arrays you must maintain the relationship between the elements across the parallel arrays. As you
move an ID number, the corresponding average must also be moved.

Explanation / Answer

Please Rate:Thanks import java.io.File; import java.text.DecimalFormat; import java.util.Scanner; public class gpa { public static void main(String[] args)throws Exception { DecimalFormat num=new DecimalFormat("#######.00"); // Create format for name num (courseName) DecimalFormat numgpa=new DecimalFormat("##.00"); // Create format for name numgpa (gpa) // variable names double gp=0.0; // grade point double totalgp=0.0; // total grade point double n=0.0; //number of courses double gpa=0.0; //greade point average String str; // to hold answer input to prompt String name; String firstName; String lastName; String inGrade; //input grade String courseName; //course name int courseSection; //section number of course char repeat; //to hold yes 'Y' or no 'N' answer char letGrade; //input letter grade int idNumber=0; //student number int i=0; //number of courses input int h=0; //number of student name in file // declare scan & associate with actual data file File scan = new File ("inputgpa.txt"); // Initialize scanner to read from file Scanner input = new Scanner(scan); // Open file and continue if there is more data in file while (input.hasNext()) { name = input.nextLine(); for(h=0; h
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