Posted by: jaka2701 July 11, 2015
little help for java newbie please!!
Login in to Rate this Post:     0       ?        
Part 1- The Student Class (10 points)

Write a class called Student. A student is described by:

a name
an ID (text-based, such as "A146")
whether or not tuition is paid
Write a constructor, getters and setters, and a toString method for this class.

Part 2- The Course Class (10 points)

Write a class called Course to represent a college class. A course is described by:

a name
the maximum students that can be enrolled in the course
Write a constructor, getters and setters (using appropriate validity checks), and a toString method.

Part 3- The Roster (10 points)

Add a roster to the Course class. A roster is represented by an array of Student objects.

Add instance data and code to the constructor to represent the roster.

(You do not need to add a getter and setter. The methods below will allow an outside class to access the roster appropriately.)

Part 4- Course Methods (50 points)

Write the following 3 methods:

public boolean addStudent(Student s)

if there is room for the student, add the student to the roster and return true

return false otherwise

public boolean dropStudent(Student s)

if the student is currently in the roster, remove them from the roster and return true

return false otherwise

Note: There are different approaches to implementing this method. Any approach is fine, but be sure to test your method thoroughly considering lots of different possible cases. (Use your driver program for this!)

public void printRoster()

print how many students are enrolled in the course

also print the list of each student on a single line (use good object-oriented principles to access a text representation of each student!)

print an appropriate message if there are no students yet enrolled

Part 5- Driver Program (20 points)

Write a driver program that does the following (in this order):

creates six students

creates a course that can hold five students

prints the course

prints the roster

adds the first five students to the course

tries to add the sixth student and prints a message if any add fails

prints the roster

drops the third student from the course

prints the roster

tries again to add the sixth student to the course

prints the roster
Read Full Discussion Thread for this article