PranovD / CS2340

MIT License
0 stars 0 forks source link

M3 - Change model and add information to Student class #9

Open adang96 opened 7 years ago

adang96 commented 7 years ago

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

To support the class standing, we will first need to create a new class named ClassStanding which is an enum with the values FRESHMAN, SOPHOMORE, JUNIOR, and SENIOR. Give each class a two character representation "FR", "SO", "JR" and "SR". Now add an attribute to Student which holds the ClassStanding enum. Add getter and setter for the ClassStanding 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. Change the toString method to contain the class standing also. In the Model facade, there is a method called replaceStudentData. You will need to add a line of code there to update the ClassStanding along with the name and major. 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.