コード例 #1
0
def atmTransaction():
    atmType = str(input("Would you like to deposit or withdraw money?"))
    if atmType == "withdraw":
        atmWithdrawMoney = int(
            input("How much money would you like to withdraw?"))
        if atmWithdrawMoney <= Balance.getBalance() and atmWithdrawMoney > 0:
            Balance.amountToDeduct(atmWithdrawMoney)
            print("You have successfully withdrew $", atmWithdrawMoney)

            Menu.displayMenu()
        else:
            print(
                "You cannot withdraw that amount of money. Please enter a number within your balance."
            )
            atmTransaction()

    elif atmType == "deposit":
        atmDepositMoney = int(
            input("How much money would you like to deposit?"))
        if atmDepositMoney <= 500000 and atmDepositMoney > 0:
            Balance.amountToAdd(atmDepositMoney)
            print("You have successfully deposited $", atmDepositMoney)

            Menu.displayMenu()
        else:
            print(
                "You cannot deposit that amount of money. Please enter a number within $1-$500,000."
            )
            atmTransaction()
    else:
        print("You can only deposit or withdraw money. Please try again.")
        atmTransaction()
コード例 #2
0
def sellStock():
    print("Sell my stocks station.")
    ticker = str(input("Please enter your ticker to sell."))
    quantity = int(input("How much stocks would you like to sell?"))
    stock_price = 150
    amount = (stock_price * quantity)
    Balance.amountToAdd(amount)
    print("You have just sold ", ticker, " and the quantity = ", quantity,
          " total amount received is ", amount)
    print("Your account balance is: ", Balance.getBalance())
    Menu.displayMenu()
コード例 #3
0
def depositMoney():
    depositAmount = int(input("How much money would you like to deposit? \n"))
    print("You are depositing: ", depositAmount)
    if Balance.getBalance() <= 0:
        print("Error: You cannot deposit that amount of money. You must deposit a natural number such as 1, 2, 3, or 4, but not 0 or a decimal. You can go as high as 100 or 100,000!")
        sleep(1)
        depositMoney()


    elif Balance.getBalance() >= 500000:
        print("Error: You cannot deposit that amount of money. You must deposit between between 0 and 500,000 dollars.")
        sleep(1)
        depositMoney()

    else:
        Balance.amountToAdd(depositAmount)
        print("You have successfully deposited ", depositAmount)
        print("Your new balance is ", Balance.getBalance())
        sleep(1)