(int codeNumber)
| 43 | } |
| 44 | |
| 45 | public Item getItem(int codeNumber) throws Exception { |
| 46 | |
| 47 | for (ItemShelf itemShelf : itemShelves) { |
| 48 | if (itemShelf.code == codeNumber) { |
| 49 | if (itemShelf.isSoldOut()) { |
| 50 | throw new Exception("item already sold out"); |
| 51 | } else { |
| 52 | |
| 53 | return itemShelf.item; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | throw new Exception("Invalid Code"); |
| 58 | } |
| 59 | |
| 60 | public void updateSoldOutItem(int codeNumber){ |
| 61 | for (ItemShelf itemShelf : itemShelves) { |