Question: Problem: Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and

Problem: Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods toString, equals, and finalize. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows:

public class Course { private String course; private String description; private int credits; private int maxStudents;

public Course( ) { }

public Course (String course, String desc, int credits, int maxNum ) { }

public String getCourse ( ) { }

public void setCourse ( String c ) { }

public String getDescription ( ) { }

public void setDescription ( String desc ) { }

public int getCredits ( ) { }

public void setCredits ( int cred ) { }

public int getStudents ( ) { }

public void setStudents ( int students ) { }

public String toString ( ) { }

public boolean equals ( Object obj ) { }

public void finalize ( ) { } }

ALL METHODS MUST BE IMPLEMENTED!!! Write a client program(test class) to THOROUGHLY test the class Course. In the client program, create two Course objects. Assign any values to the two objects. Exercise the methods to verify their functionality.

Approach to Testing: Create TWO class objects o One object with the default constructor Test the set methods initializing the instance variables to the desired values. Use the get methods to verify that the sets worked properly. o One object with the overloaded constructor setting unique values in instance variables Test the set methods with the default object Test the get methods System.out.println ( course = + obj.getCourse() ). Test the toString method never EXPLICITLY call the toString method. Two separate files: Course.java CourseTest.java (client program) ( or other name )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!