Question: Your task for this project is to create a very simple ATM. The project is broken into three sections: Collect customer input Calculate the ending

Your task for this project is to create a very simple ATM. The project is broken into three sections:

Collect customer input

Calculate the ending balance

Display the results to the customer

*Your final output should look like this:

Beginning Balance: 500.50 Deposit Amount: 200 Withdrawal Amount: 100

----------------------------------------------------------------

Input

The file is set up with a function to print the user options menu.

a. Create a prompt for the user to input the the account action. There are three actions:

Code Action Function
D Deposit deposit_amount
W Withdrawal withdrawal_amount
B Account Balance account_balance

Request opening balance. Assign the opening balance to a variable called account_balance equal to $500.25. You will need to use the 'float' method in order to ensure that 'account_balance' is a float value.

Request the action to be taken on the account.

Create the action for Account Balance B, output to the console the account balance.

Input Information

The following data will be used as input in the test:

userchoice = input ("What would you like to do?") userchoice = 'B' 

Output Information

Your current balance: 500.25 

----------------------------------------------------------------

Calculate the Balance - Deposit

If the action is Deposit 'D, use a deposit function to add funds to the account

You will need to write a function called deposit.

Request from the user the amount to be deposited. This value should be stored in a variable called deposit_amount. Use both the input and floatmethods in order to ensure the deposit_amount is a float value

Calculate a new account balance. Assign this calculation to a variable named balance.

The calculation for depositing funds into the account is balance = account_balance + deposit_amount

Print out the new account balance

----------------------------------------------------------------

Calculate the Balance - Withdrawal

If the action is Withdrawal W, use the withdrawal function to remove funds from the account

You will need to define a function called withdrawal.

Request from the user the amount to be withdrawn. This value should be stored in a variable called withdrawal_amount. Use both the input and floatmethods in order to ensure the withdrawal_amount is a float value

Ensure the withdrawal_amount is not greater than the account_balance.If the withdrawal_amount is greater than the `account_balance`, print the following message:

withdrawal_amount is greater that your account balance of account_balance

Ensure you display the withdrawal amount and the account balance with the '$' and two decimal points.

If the withdrawal amount is less than or equal to the account_balance then calculate a new account balance. Assign this calculation to a variable named balance

The calculation for withdrawing funds from the account is account_balance = account_balance -withdrawal_amount

Print print the following message:

Withdrawal amount was withdrawal_amount, your current balance is account_balance

Hint The formatter for a float value in Python is %f. With the formatter %.2f, you format the float to have 2 decimal places. For example:

print("Account balance: $%.2f" % account_balance)

Withdrawal Information

Withdraw Input

userchoice = input ("What would you like to do? ") userchoice = 'W' withdrawal_amount = 100 

Withdraw Output

What would you like to do? How much would you like to withdraw? Withdrawal amount was $100, current balance is $600.25 

----------------------------------------------------------------

ATM Summary

Your final function in the ATM Script is the Print the Customer summary as follows:

Final Input

userchoice = input ("What would you like to do? ") userchoice = 'Q' 

Final Output

What would you like to do? Thank you for banking with us. 

----------------------------------------------------------------

Given Code:

import sys

#account balance account_balance = float(500.25)

#<--------functions go here--------------------> #printbalance function

#deposit function

#withdraw function

#User Input goes here, use if/else conditional statement to call function based on user input

userchoice = input ("What would you like to do? ")

if (userchoice == 'D'): deposit ()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!