A student record contains the following information: student id, audit status, a
ID: 3866965 • Letter: A
Question
A student record contains the following information: student id, audit status, assignment score, and exam score. For example: The above information is stored in a file named "namelist.txt" in the following format: 20123456 100 79 false 20011111 97 82 true Given the following definition of the Student class, complete the body of the constructor of the class so that it initializes the instance variables with the arguments passed in. The Student class consists of 3 instance variables including id for student id, isUST for indicating if the students is a UST student or not and a integer array scores for the assignment and exam scores. public class student { private String id;//student ID private boolean isUST;//is UST student or not //integer array containing 2 entries, first the //assignment score and then the exam score private int[] scores: /** * Constructor * @ param id the student ID *@ param s1 the assignment score *@param s2 the exam score * @ param isUST is UST the student or not public Student(String id, int s1, int s2, boolean isUST) { } } The Course class is designed to contain an array of n students. Complete implementation of the readRecords () method so that it reads the file "namelist.txt", and stores the information into the Student array, studentList, inside the Course class. import java.io.*: import java.util.Scanner: public class Course { private Student[] studentList: public Course (int n): studentList = new Student [n]: } //read all records from file and add it to studentList public void readRecords() throws IOException { //create a File object for "namelist.txt" //construct a Scanner object on the file int numStudent = 0: //Continue to read from the file if there is a line to //read. You may assume that the 4 entries in the line always //exist are of the correct type. Create a student object //with the correct parameters and add it to studentList for //each line read. while (_______________________) { } fileScanner.close();//release input file } }Explanation / Answer
Part B
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.