Thursday, September 16, 2010

Lab 8 - section 6

Develop and implement a class Student that represents a University Student. A Student object should have four attributes: the name of the student, the DOB of the student, the name of the university where the student is studying and height of the student. The class should provide the following methods:
(1) void setName(String s): sets the name of the student to s.
(2) String getName(): returns the name of the student.
(3) void setDOB(String s): sets the DOB of the student to s
(4) String getDOB(): returns the DOB of the student.
(5) void setUniversity(String s): sets the university name to s
(6) String getUniversity(): returns the University name.
(7) void setHeight(double d): sets the height of the student to d
(8) double getHeight(): returns the height of the student.
Include a main method in the Student class that tests all of the methods you have defined.

No comments: