Consider the code from assignment one

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
if (small > small_count || medium > medium_count || large > large_count) {
  freeRooms = this.venue.getFreeRooms(dateRange);
}

if (small > small_count) {
  this.addRooms(Room.getRoomsBySize(freeRooms, Size.SMALL), small - small_count);
} else if (small < small_count) {
  this.removeRooms(Size.SMALL, small_count - small);
}

if (medium > medium_count) {
  this.addRooms(Room.getRoomsBySize(freeRooms, Size.MEDIUM), medium - medium_count);
} else if (medium < medium_count) {
  this.removeRooms(Size.MEDIUM, medium_count - medium);
}

if (large > large_count) {
  this.addRooms(Room.getRoomsBySize(freeRooms, Size.LARGE), large - large_count);
} else if (large < large_count) {
  this.removeRooms(Size.LARGE, large_count - large);
}

Source

If we were to add more room sizes, we would have to add another repeated block of code for each size.
We can avoid that by using polymorphism (where an object changes functionality depending on its required use)