Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

MySchool is a Java application for schools. It reads data from files. IMPORTANT: you should change data in these files to verify your program. We will use different files during marking. Section 1:...

1 answer below »
MySchool is a Java application for schools. It reads data from files. IMPORTANT: you should change data in these files to verify your program. We will use different files during marking.
Section 1: PASS Level
At this level, your program can read from a file specified in command line and store student scores in a 2D integer a
ay. You may define methods wherever appropriate to support the functionalities.
scores.txt
34 C081 C082 C083 C084
S XXXXXXXXXX 62
S XXXXXXXXXX 52
S XXXXXXXXXX -1
The file stores data as a text table shown above. Data fields are separated by spaces and new lines. The first row contains course IDs and the first column contains student IDs. The first field in the data, the top left corner, shows the number of rows and the number of columns in one integer. For example ‘34’, the first digit 3 means there are 3 students in this table. The second digit 4 means there are 4 courses. You can assume that the total number of courses will never be more than 9.
The table stores every student’s final results in those courses. Results are all integers. A result ‘-1’ means not enrolled in that course. A ‘0’ means the student did enrol but failed to receive any mark. Your program can find the student with the highest average score and display on the command line:
java MySchool scores.txt
The top student is S2023 with an average 80
Section 2: CREDIT Level --- You must ONLY attempt this level after you complete the PASS level
Your program can read one more file which stores the information of courses offered by the school. Info includes course ID, course title and credit points. You can assume all courses of the school appear in this file and in the first file (student results file). There is no duplicate or redundant courses.
courses.txt
C081 Mathematics 12
C082 Science 12
C083 English 24
C084 Technologies 6
At this level your program can produce a text file named as course_report.txt.
java MySchool scores.txt courses.txt
The top student is S2023 with an average 80
courses_report.txt generated!
Given the above courses.txt, course_report.txt should look like below. The fourth column is the number of enrolled students. The fifth column is the average score of each course.
C081 Mathematics XXXXXXXXXX
C082 Science XXXXXXXXXX
C083 English XXXXXXXXXX
C084 Technologies 6 2 57
Section 3: DI Level --- You must ONLY attempt this level after you complete the CREDIT level
A this level, your program can read one more file from command line. That file stores information about students, that includes student ID, name (no space between first name and last name, but an underscore) and age. You can assume all students appear in this file as well as in the first file (student results file). There is no duplicate records or empty records.
students.txt
S2023 Sue_Vaneer 14
S2025 Robin_Smith 13
S1909 Ba
y_Banks 15
At this level your program can produce a text file report named as student_report.txt.
java MySchool scores.txt courses.txt students.txt
The top student is S2023 with an average 80
course_report.txt generated!
student_report.txt generated!
Given the above students.txt, student_report.txt should look like below. The fourth column is the number of courses that student enrolled im. The fifth column is the average GPA. A course result of 80+ receives 4 GPA points. A result of 70-79 receives 3 points. A result in between 60-69 is 2 points XXXXXXXXXXgets 1 points. Under 50 has 0 points. For example Sue Vaneer has 2 HD, 1 DI and 1 CR. So her GPA is ( 4 x XXXXXXXXXX ) / 4 = 3.25.
S2023 Sue_Vaneer XXXXXXXXXX
S2025 Robin_Smith XXXXXXXXXX
S1909 Ba
y_Banks XXXXXXXXXX
At this level, your program can handle some variations in the files.
(1) characters in sources.txt will be treated as -1.
(2) decimal numbers will be treated as integers, ignoring the decimal part, e.g 99.5 -> 99
(3) The order of lines in both students.txt and courses.txt does not matter. (You can
assume that the order of columns does not change.)
scores.txt                    students.txt
34 C081 C082 C083 C XXXXXXXXXXS1909 Ba
y_Banks 15
S XXXXXXXXXX XXXXXXXXXXS2025 Robin_Smith 13
S2025 x XXXXXXXXXX XXXXXXXXXXS2023 Sue_Vaneer 14
S XXXXXXXXXX45 abc
[Hint] You may find exception useful.
Section 4: HD Level --- You must ONLY attempt this level after you complete the DI level.
A this level, your program achieves the above requirements in OO style with at least three classes, School , Student and Course. Design the appropriate instance variables, constructor(s) and methods for these classes. Class related info should be encapsulated inside of these classes.
In addition, student_report.txt generated at this level is more advanced, taking credit points of each course into consideration. See below. The fourth column is now the total credit points that the student has completed. For example Sue Vaneer, she has done all four courses, so she earned XXXXXXXXXX = 54 credit points. The fifth column is the adjusted GPA. So that for Sue is (4 x XXXXXXXXXXx
12 + 4 x XXXXXXXXXXx 6 ) / 54 = 3.55, which is more accurate than that in the DI level.
S2023 Sue_Vaneer XXXXXXXXXX
S2025 Robin_Smith XXXXXXXXXX
S1909 Ba
y_Banks XXXXXXXXXX
Section 5: Miscellaneous
To verify the calculations, you can import the files, especial the provided test files, into a spreadsheet tool, e.g. Excel, Google Spreadsheet, Numbers, which can easily compute average, max etc.
You program may have no interaction with users during execution. Simply run the code, read the files, display output and/or generate file(s).
You can assume user always type file names in the right order in command line, e.g. score file first, then course file, then student file. However it is possible that file is missing or cannot be found. Your program should quite gracefully in these circumstances.
1. Your final code submission should be clean, neat, and well-formatted (e.g., consistent indentations) and abide by the formatting guidelines.
2. Identifiers should be named properly and camel case e.g. UsedCar (class) and carPrice (variable). [Google “camel case”]
3. You must include adequate meaningful code-level comments in your program.
4. IMPORTANT: your code should be able to compile and run under command line.
Code must be compiled under command line with no e
or,
javac MySchool.java
and runnable under command line
java MySchool scores.txt courses.txt students.txt

C081 Mathematics 12
C082 Science     12
C083 English XXXXXXXXXX
C084 Technologies 6

XXXXXXXXXXC081 C082 C083 C084
S XXXXXXXXXX XXXXXXXXXX
S XXXXXXXXXX XXXXXXXXXX
S XXXXXXXXXX XXXXXXXXXX

S2023     Sue_Vaneer 14
S2025     Robin_Smith 13
S1909     Ba
y_Banks 15
Answered Same Day Jun 11, 2021

Solution

Valupadasu answered on Jun 13 2021
148 Votes
Course.java
Course.java
public class Course {
    private String courseID;
    private String courseName;
    private int courseCode;
    public Course(String courseID,String courseName,int courseCode){
        this.courseID = courseID;
        this.courseName = courseName;
        this.courseCode = courseCode;
    }
    public String getCourseID() {
        return courseID;
    }
    public void setCourseID(String courseID) {
        this.courseID = courseID;
    }
    public String getCourseName() {
        return courseName;
    }
    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }
    public int getCourseCode() {
        return courseCode;
    }
    public void setCourseCode(int courseCode) {
        this.courseCode = courseCode;
    }
}
courses.txt
C081 Mathematics 12
C082 Science     12
C083 English 24
C084 Technologies 6
courses_report.txt
C081 Mathematics 12 2 99
C082 Science     12 3 83
C083 English 24 3 65
C084 Technologies 6 2...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here