The goals of this assignment are:
Requirements:
WARNING: In this assignment you are NOT ALLOWED to import any packages or classes besides for
java.util.Scanner
,java.io.File
, andjava.io.FileNotFoundException
. For example, you cannot use the builtinArrays
java class to print out an array. Doing so will result in earning ZERO POINTS for a method that uses it.
IF YOUR CODE DOES NOT COMPILE, YOU WILL EARN ZERO POINTS.
We will begin this assignment by creating an Instructor
class. The instructor class will be pretty simple. It contains the following information:
The Instructor
class must have the following instance methods:
You must use your main method to test the implementations for all of the instance methods in this class.
Implement a class named StudentCourse
that represents a course in a student’s schedule. Each course should have the following information:
F
or S
)The StudentCourse
class must have the following instance methods:
toString()
- you are free to design this how you like, just make sure the resulting String contains information from all the instance variablesequals()
that compares all the instance variablesYou can use your main method to test the implementations for the instance methods in this class but we will not be checking this, i.e. you will not be graded for testing these methods in main.
Implement a class named Student
that represents a student. Each Student
should have the following information:
The Student
class must have the following instance methods:
toString()
- you are free to design this how you like, just make sure the resulting String contains information from all the instance variablesequals()
that compares all the instance variablescomputeGPA()
- computes the student’s GPA across all courses they have taken.computeGPA(char semester)
- computes the student’s GPA across all courses they have taken in the fall or spring.computeGPA(int year)
- computes the student’s GPA across all courses they have taken in a specific year.computeGPA(char semester, int year)
- computes the student’s GPA across all courses they have taken in a specific semester.addCourse(StudentCourse course)
- adds a course to the student’s list of courses.You can use your main method to test the implementations for the instance methods in this class but we will not be checking this, i.e. you will not be graded for testing these methods in main.
Since we are assuming that every course is 1 credit, the GPA is calculated by just taking the average of the grades earned in each course.
Create a new program called Driver
.
The program should read in a filename as a command line argument. This file will list course information for all of the courses that a student has taken.
We have provided an example csv
file courses.csv that you can use to test your program.
If the program is not passed in a command line argument, the program should tell the user and terminate.
The program must print out the following information on a new line:
GPA
each semesterGPA
across fall semestersGPA
across spring semestersGPA
across each academic yearGPA
, i.e. the GPA in the classes that are just in their major.GPA
In a text file called README.txt
answer the following questions:
Dont forget: make sure to fill in the header in all of your java files.
Submit the following files to the assignment called HW09
on Gradescope:
Instructor.java
StudentCourse.java
Student.java
Driver.java
README.txt
Make sure to name these files exactly what we specify here and name the methods exactly what we specify too. Otherwise, our autograders might not work and we might have to take points off.