Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface SlotMachine {
- /**
- * Insert the coin into the slot machine. If the coin is unknown,
- * return directly.
- *
- * @param coin the coin to insert
- * @return the unknown coin
- */
- Optional<Coin> insert(Coin coin);
- /**
- * Select the drink to buy. If the value of the current inserted coins
- * is larger than the slot's price and the slot still has drinks, it
- * returns the drink; otherwise {@code null}.
- *
- * @param index the slot index
- * @return the drink if available
- */
- Optional<Drink> select(int index);
- /**
- * Refund the unused fee.
- *
- * @return the unused fee in coins
- */
- Coin[] refund();
- /**
- * Get the value (not the amount) of the inserted coins. For example,
- * the value of two 10 dollar coins is 20, not 2 (amount).
- *
- * @return the inserted fee
- */
- int getInsertedFee();
- /**
- * Get the amount of the slots provided by the machine.
- *
- * @return the amounts of the slots
- */
- int getSolts();
- /**
- * Get the slot information of the specified index.
- *
- * @param index the slot index
- * @return the slot information if the index is correct
- */
- Optional<SlotInfo> getSlot(int index);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement