Add switch/case

This commit is contained in:
Richard Xu 2022-12-22 12:23:11 -05:00
parent 851d9c423a
commit a631413208

View File

@ -19,6 +19,14 @@ class GildedRose {
}
private static void handleDay(Item item) {
switch (item.name) {
case AGED_BRIE:
handleAgedBrie(item);
return;
case SULFURAS:
handleSulfuras(item);
return;
}
if (!item.name.equals(AGED_BRIE)
&& !item.name.equals(BACKSTAGE_PASSES)) {
if (item.quality > 0) {
@ -68,4 +76,15 @@ class GildedRose {
}
}
}
private static void handleSulfuras(Item item) {
}
private static void handleAgedBrie(Item item) {
if (item.quality != 50) {
item.quality += 1;
}
item.sellIn -= 1;
}
}