Open dsantistevan opened 4 years ago
Now to extend the amount of items it's just needed to add them at the initiateFood method, it could also read from a file, but now it is only necessary to modify initiateFood.
static void initiateFood() {
foodList.add(new FoodItem(50,1));
foodList.add(new FoodItem(60,2));
foodList.add(new FoodItem(70,3));
foodList.add(new FoodItem(30,4));
}
Line 52-52 | π΄ High importance - 1 |
Line 74-74 | π΄ High importance - 1 |
Line 503-503 | π΄ High importance - 1 |
Line 525-525 | π΄ High importance - 1 |
Line 11-11 | π΄ High importance - 1 |
3 The class Guest that has the variables held before by a room has been added to the project, also some changes were made to the Project.java class in order to comply with it. The class Guest has the following structure:
The attributes kept default access so the program can access them like before.
5 The fixes to the OCP principle were made by creating an abstract class Room that has an ArrayList of Guest objects and can add up to maxCapacity int variable amount of elements. SingleRoom has a maxCapacity of 1 and DoubleRoom a max capacity of 2. Also, the code was adjusted to comply with these changes.
The class Room has the following structure and method addGuest():