ajliu / CS2340-Project

0 stars 0 forks source link

M3: Change the Model #4

Closed ajliu closed 7 years ago

ajliu commented 7 years ago

Since the customer's request is to add information to the Student, we can focus on the Student class.

  1. To support the class standing, we will first need to create a new class named ClassStanding which is a1. n enum with the values FRESHMAN, SOPHOMORE, JUNIOR, and SENIOR. Give each class a two character representation "FR", "SO", "JR" and "SR".
  2. Now add an attribute to Student which holds the ClassStanding enum.
  3. Add getter and setter for the ClassStanding
  4. Make a new 3 param constructor which includes name, major and class standing. Keep the old two param constructor for backwards compatibility and use constructor chaining to give a default class standing of Freshman.
  5. Change the toString method to contain the class standing also.

At this point the model should be runnable and we should see the changes reflected in the list. Go ahead and run the app at this point. You should see all the students listed as before except with their classes shown. If you don't see the classes, be sure your constructor chaining is passing the freshman value to the 3 param version. Also be sure you added the class standing to the toString method.