Java Reference
In-Depth Information
public String getCourseName()
{
return courseName;
}
public String getCourseNumber()
{
return courseNo;
}
public int getCredits()
{
return courseCredits;
}
public void copyCourseInfo(Course otherCourse)
{
courseName = otherCourse.courseName;
courseNo = otherCourse.courseNo;
courseCredits = otherCourse.courseCredits;
}
The definition of the class Course looks like the following: (You can complete the
definition of this class as an exercise.)
import
java.io.*;
public class Course
{
private String courseName; //object to store the
//course name
private String courseNo; //object to store the
//course number
private int courseCredits; //variable to store the
//course credits
//Place the definitions of the instance methods
//as discussed here.
1
0
}
Next, we discuss the component Student .
The main characteristics of a student are the student name, student ID, number of
courses in which the student is enrolled, courses in which the student is enrolled, and
the grade for each course. Because every student must pay tuition, we also include a
member to indicate whether the student has paid the tuition.
Every student is a person, and every student takes courses. We have already designed a
class Person to process a person's first and last name. We have also designed a class to
process the course information. Thus, we see that we can derive the class Student to
Search WWH ::




Custom Search