Question
11.18 Composition Assignment Write a Java program that prompts user for a file name, opens and reads the data, process, and store them in an
11.18 Composition Assignment
Write a Java program that prompts user for a file name, opens and reads the data, process, and store them in an array or ArrayList of students. A Student (you need to declare it) is a class defining a Student with information (such as name, id and a list of courses) and associated operations; Course is a class containing information (such as name, grade and number of units) and associated operations. The program calculates the total completed units and GPA for a student. The program then prints a table to the monitor and stops execution. (Refer to the sample below.)
Use the following table to assign points for a course:
Grade | Points |
---|---|
A | 4.0 |
B | 3.0 |
C | 2.0 |
D | 1.0 |
F | 0.0 |
To calculate the GPA multiply units by points for each course, and then add then together and divide the sum by total units. For example if course 1 has 5 units and the grade is A (4 points) and course 2 has 4 units and the grade is B (3 points), and course 3 has 4 units and the grade is F then (4 * 3 + 5 * 4 + 4 * 0)/13 = 2.462. Completed course are all the courses that have a passing grade (a, b, c, and d), Units taken is sum of all units registered for.
Completed courses are considered the ones with passing grade (A,B,C,D).
Input File Format: | Input File Sample: |
---|---|
Last, First | Smith Jr., Joe |
ID numberofcourses | 111-22-3333 3 |
Course 1 name | Physics I |
Grade Units | A 5 |
Course 2 name | English 1A |
Grade Units | B 4 |
Course 3 name | English 1B |
Grade Units | F 4 |
Jones , Bill | |
111-11-1111 4 | |
Physics I | |
A 5 | |
Chemistry 1A | |
B 5 | |
Computer Science 1 | |
A 4 | |
Chemistry 1 Lab | |
B 1 |
Requirements:
- Develop a class to represent a Student (the following data members must be included, more is OK) :
- Name (First, Last)
- Id number
- list of courses
- number of units taken
- units completed
- units taken
- average.
- Develop a class to represent a Course(the following data members must be included, more is OK):
- Course Name
- Course Units
- Course Grade
- Program must be modular (all tasks must be done in methods)
- Must include methods to process array of students
- UML representation of classes
- Prompt user for all input and output file names
- Use attached data file to test your program.
- Error check files
- If you use an array, set array size to 20 for students and courses, but when adding elements check the size to make sure not to overflow the array.
Final report to the monitor and output file
Sample output:
Name Id Units Taken Units Completed Average Joe Smith Jr. 111-22-3333 13 9 2.46 Bill Jones 111-11-1111 15 15 3.60 Nancy Brown 222-11-1111 42 38 3.38 Total number of Students: 3 Total Units completed by all students: 62 Total Units taken by all students: 70
Required files to submit:
- Student.java
- Course.java
- MangeStudent.java
//students.txt
Smithson, John 111-99-3333 3 Chemistry I A 5 English ESL A 4 English 1B F 4 Jonesville, Bill 111-99-1111 3 Physics I A 5 Computer Science 1 A 4 Chemistry 1 Lab B 1 Brownsen, Nancy 222-11-1111 12 English 1A B 4 English 1B F 4 Physics II A 5 Geology 101 B 3 Chemistry 1A B 5 Computer Science 1 A 4 Chemistry 1A Lab B 1 Physics II Lab A 1 Physics III A 5 Physics III Lab A 1 Chemistry 1B A 5 Chemistry 1B Lab A 1 Smith Jr., Joe 111-22-3333 3 Physics I A 5 English 1A B 4 English 1B F 4 Jones, Bill 111-11-1111 4 Physics I A 5 Chemistry 1A B 5 Computer Science 1 A 4 Chemistry 1 Lab B 1 Brown, Nancy 222-11-1111 13 Physics I A 5 English 1A B 4 English 1B F 4 Physics II A 5 Chemistry 1A B 5 Computer Science 1 A 4 Chemistry 1A Lab B 1 Physics I Lab A 1 Physics II Lab A 1 Physics III A 5 Physics III Lab A 1 Chemistry 1B A 5 Chemistry 1B Lab A 1
//lab5.txt
Smith Jr., Joe 111-22-3333 3 Physics I A 5 English 1A B 4 English 1B F 4 Jones, Bill 111-11-1111 4 Physics I A 5 Chemistry 1A B 5 Computer Science 1 A 4 Chemistry 1 Lab B 1 Brown, Nancy 222-11-1111 13 Physics I A 5 English 1A B 4 English 1B F 4 Physics II A 5 Chemistry 1A B 5 Computer Science 1 A 4 Chemistry 1A Lab B 1 Physics I Lab A 1 Physics II Lab A 1 Physics III A 5 Physics III Lab A 1 Chemistry 1B A 5 Chemistry 1B Lab A 1
//blank.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started