Home‎ > ‎ICT Programming‎ > ‎

The Student Class

** Use the Dog Class as your example template to follow **

Student Class


For this lab you will work with a partner to create a class called Student

Copy the code for the dog class but you will need to change all of the dog variables to match the information needed below:

Here are the attributes of a student that we need for this project:

 first name (String)
 last name (String)
 student number, e.g. 00012345 (int)
 email address (String)
 number of courses completed (int)
 grade, e.g. 78.5 (double)
 is the student passing? true or false (boolean)

Choose appropriate data types and descriptive names for the fields (instance variables), and
declare them. Be sure to specify that they are private.

Modify the Dog Class constructor to work for this class. The constructor will expect all the information to be passed in as parameters. Choose descriptive names for the parameters but remember that they cannot be the same as the field names. Use the parameters to initialize the fields.

Test your project by creating a Student object. Use the BlueJ inspector to check the contents of
the fields.

Once you have completed this class and your methods work, please submit to the hand-in folder.

Comments