Java Reference
In-Depth Information
private void sortCourses()
//Method to sort the courses
//Postcondition: The array coursesEnrolled is sorted.
//
The grades for each course, in the
//
array courseGrades, are also reorganized.
public Student()
//Default constructor
//Postcondition: The instance variables are initialized.
Figure 10-19 shows the UML class diagram of the class Student .
Student
-sId: int
-numberOfCourses: int
-isTuitionPaid: boolean
-coursesEnrolled: Course[]
-courseGrades: char []
+Student()
+setInfo(String, String, int , int
boolean , Course[], char []): void
+setStudentId( int ): void
+setIsTuitionPaid( boolean ): void
+setNumberOfCourses( int ): void
+setCoursesEnrolled(Course[], char []): void
+toString(): String
+getStudentId(): int
+getIsTuitionPaid(): boolean
+getNumberOfCourses(): int
+getCourse( int ): Course
+getGrade( int i): char
+getHoursEnrolled(): int
+getGpa(): double
+billingAmount( double ): double
-sortCourses(): void
Person
Student
Course
FIGURE 10-19 UML class diagram of the class Student
Note that the method sortCourses to sort the array coursesEnrolled is a private
member of the class Student . This is because this method is needed for internal data
manipulation, and the user of the class does not need to access this member.
Next, we discuss the definitions of the methods to implement the operations of the
class Student .
The method setInfo first initializes the private data members according to the
incoming parameters. This method then calls the method sortCourses to sort the
 
Search WWH ::




Custom Search