Project2 :
Intro to OOP
Due: Oct 6th at 11:59pm
Summary: It is time to start object oriented programming.
Some of you have asked for the grading
rubric for this project.
Here it is.
Details:
Implement the 4 classes in the UML diagram above. More details are below.
The Student Class:
- Needs to have the four instance variables and one class/static
variable shown in the diagram
- nextID is the class variable.
- The constructor should take two
parameters.
- it must initialize the instance variable Name with the studentName
param
- it must initialize the instance variable advisor with the
initialAdvisor param
- the gpa instance variable should be initialized to 0.0
- initialize the numberOfCredits instance variable to 0
- the StudentID instance variable should be assigned the value of the
nextID static class variable
- the nextID class variable should be incremented.
- The takeClass method should
- adjust the numberOfCredits by the credits parameter
- adjust the gpa instance variable to include the new course including
the credits and grade
- changeAdvisor
- update the advisor instance variable to the new value from the
parameter
- getGPA
- accessor for the gpa instance variable
- getCreditHours
- accessor for the numberOfCredits instance variable
- getStudentID
- accessor for the studentID instance variable
- toString
- this method should create a string that details the student's
- name
- studentID
- advisor's name
- gpa
- make sure that this string makes it clear what each of these pieces
of data are. (your user shouldn't have to guess.)
- return this string
- the getAdvisor method
- is an accessor returning the advisor instance variable.
The Professor Class:
- Needs to have 3 instance variables as per the diagram
- The constructor should take two
parameters
- the name instance variable should be initialized by the profName
parameter
- the department instance variable should be initialized by the dept
instance variable
- the adviseeList instance variable should be initialized to a new
ArrayList of Students (which is currently empty)
- The addAdvisee method
- should add the parameter to the adviseeList instance variable
- The removeAdvisee method
- removes the paramter to from the adviseeList if that student object
is in the adviseeList
- The getName method
- accessor for the name instance variable.
- the toString method
- this method should create a string that details
- the professor and
- the department
- return this string
The Main Class:
should have only one function
- The main function ( public
statice void main)
- must only have two lines:
- create a new University Object
- call runUniversity on that object
The University Class:
- Needs two instance variables as specified in the diagram.
- The constructor
- must initialize the two instance variables to new empty arrayLists
of the appropriate type
- The findStudend method takes a
studentId as a parameter
- it needs to search through the studentList instance variable to find
a student object with the right studentID
- it needs to return an Optional<Student>
- if the student was found, then the Optional needs to include that
student
- if the student was not found in the studentList, then this
function needs to return an empty Optional<Student>
- The hireProfessor method
- adds the newFaculty parameter to the faculty instance variable
- The admitStudent method
- add the newStudent parameter to the studentList
- The graduateStudents method
- should iterate through the entire studentList
- if the student
- has a gpa of at least 2.0
- and at least 20 credits (yes that is too low, but I don't want
to spend forever grading)
- then
- remove that student from the studentList
- and print
- a congratulations message
- the student's name
- and
- if the GPA is greater than 3.7 mention the student graduates
with high honors
- if the student didn't earn high honors but has a gpa of at
least 3.3 then mention they graduate with honors
- The runUniversity method:
- feel free to break this method into
pieces and make private methods to do parts of what is listed here.
(and just call those private methods from this one)
- needs to display the top level menu which should provide the
following options:
- Admit Student
- prompt the user to enter the details you need
- create a new student object
- randomly select a professor from the professor list to be the
initial advisor.
- call the admitStudent method
- hire professor
- prompt the user to enter the details that you need
- create a new Professor object
- call the hireProfessor method
- process graduation
- call the graduateStudents method
- Look up student
- prompt the user to enter a studentID
- call findstudent
- if the student was found, print the student's details (using
toString)
- give the user the option to enter the student menu (see below)
using this student
- if the student was not found, print a message to that effect.
- exit
- end the program
- The Student menu needs to allow the following:
- call takeClass on this student
- prompt the user for the float version of the grade
- and the number of credits this class was worth.
- select advisor
- show a list of all of the professors (
- to do this iterate through the professor list and use tostring
on each professor
- give the user a way to select a professor
- get the student's current advisor and call removeAdvisee on that
professor.
- call changeAdvisor on the student(passing the newly selected
professor)
- call addAdvisee on the newly selected professor passing the
student as a parameter.
Have fun and learn a lot. This will take
some time, but each piece is fairly straightforward.
Additional Requirements:
- create a new project in intellij (don't submit a bunch of notes
and other extraneous files as part of the project)
- be sure to include your name in the project name somewhere.
- Start with one of the classes, and build it. Add it to git, and share
on github early and often I will look at the commit history. I am
looking for evidence that you committed a lot a small amount of credit
will be reserved for this
Submission:
Submit
by sharingthe project with me on github as you did last time.