# paystation.py

class IllegalCoinException(Exception):
    pass


class PayStation:

    """Implements the business logic of a pay station """

    LEGAL_COINS = [5, 10, 25]

    def __init__(self):
        self._amt_inserted = 0

    def add_payment(self, coinvalue):
        """Add coinvalue in payment to the purchase

        pre: coinvalue is an int representing the value in cents
        post: raises IllegalCoinException if coinvalue is not valid
        """

        if coinvalue not in self.LEGAL_COINS:
            raise IllegalCoinException("Bad Coin {}".format(coinvalue))
        self._amt_inserted += coinvalue

    def read_display(self):
        """Reads the value to display

        Returns: the number to be displayed as an int (minutes purchased)
        """

        return self._amt_inserted // 5 * 2

    def buy(self):
        """Buy parking time

        Terminates the transaction and returns a receipt
        """

    def cancel(self):
        """Canel the current transaction

        Resets the state for the start of new transaction
        """


class Receipt:
    """A receipt is the object returned from a PayStation Transaction"""

    def value(self):
        """Returns the number of minutes on the receipt"""
