Intermediate Computing

Homework #2

Due : Code is due Wednesday September 16th at 11:00 AM (YES, that is correct)

Printouts are due at the start of class

Introduction

Let's see how well you learned how to write basic code in Java.  In this assignment I will ask you to write three classes that together could be used as part of a student/course management system at a university.  Notice that the creation of the third class will depend on having created the first two.  Thus, I suggest that you create and test these in the order proposed below.

 

Class One - Student

Each student at the university is stored as an instance of the Student class.  Each instance knows the student's name, idNumber, total credits earned and GPA.

Individual instances respond to the following methods

Additionally, Student has a single constructor that requires the client code provide the student's full name and ID numbers (as Strings) at construction time.  By default, students begin with 0 credit hours and a GPA of 0.0

For example,

    Student student1 = new Student("Ben Schafer","123456");

 

Class Two - Faculty

Each faculty member at the university is stored as an instance of the Faculty class.  Each instance of faculty knows the faculty member's name, his faculty ID number, his office number, the number of courses he teaches, and his annual salary.

Individual instances respond to the following methods

 

Additionally, Faculty has a single constructor that requires the client code provide the member's full name and ID numbers (as Strings) as well as their initial salary.  By default, faculty begin teaching 2 courses a semester and their office is undefined at hiring time.

For example,

    Faculty faculty1 = new Faculty("Dr. Ben Schafer","654321",123456.78);

 

Class Three - Course

Each class taught at the University is stored as an instance of the Course class.  Each instance of course knows the course number, the course name, the course room number, the maximum number of students allowed to enroll, the Faculty member who is teaching the course, and a collection of all  Students currently enrolled in the course.

Individual instances respond to the following methods

Notice that not all data has setter methods.  This is done on purpose.

Additionally, Course has a single constructor that requires the client code provide the course number and course name (as Strings) as well as a maximum size.  By default, the location and faculty teaching the course are not initially assigned but must be done later through appropriate methods.

For example,

    Course course1 = new Course("810:053","Intermediate Computing",18);

Suggestions

As you write the code for this assignment you should also write one or more classes that contain main methods that test what you are doing.  Use a version of Book.java as an example to write a class that creates two Student objects, and one faculty object and then sets up a Course to be taught to the two students by the given faculty member.

There are things in this assignment that you will not immediately know how to do.  When you hit those ideas you should:


Submitting your assignment

Once you have everything completed and working it is time to prepare your assignment for submission.  Just to be safe, you may want to review my homework collection policies.

To upload your homework, log on to the homework submission system at:

and submit the following

Print paper copies of these, staple them together in the order listed above, and bring this single, stapled, packet to class on the due date.


One good solution, and how I tested it (added here AFTER the assignment was due)

Below is a zip file containing all five of the test files I used when I graded your assignment and ONE possible set of answers for the Student, Faculty, and Course classes assigned above.  These should pass all tests and demonstrate GENERALLY good programming.