1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lapo4ka [179]
2 years ago
6

You’ve been hired to help a bank automate their deposit/withdrawal system! Your task is to write a Python program that interacts

with a customer in order to process a deposit or withdrawal.
Assume the customer has an initial balance of $1000 (you should store the number 1000 in a variable). Then, ask the user two things:

Whether they want to make a deposit or withdrawal

For this step, they should type a deposit or withdrawal, depending on what they want to do. It needs to be the exact spelling, including capitalization!
How much money they want to deposit or withdraw

For this step, they should enter an integer.
Then, your program should use an if/elif/else statement to do the following:

If the customer is making a deposit, add the amount to their balance.
If the customer is making a withdrawal, subtract the amount from their balance.
If the customer typed something other than "deposit" or "withdrawal", print "Invalid transaction.".
In this case, the customer’s final balance is just the same as their initial balance.
Finally, your program should use an if/else statement to do the following:

If the customer’s final balance would be negative (less than zero), tell them "You cannot have a negative balance!".
Otherwise, report their final balance.
Here are some examples of what running your program should look like:

Example 1:

Deposit or withdrawal: withdrawal
Enter amount: 500
Final balance: 500

Example 2:

Deposit or withdrawal: withdrawal
Enter amount: 1500
You cannot have a negative balance!

Example 3:

Deposit or withdrawal: deposit
Enter amount: 500
Final balance: 1500

Computers and Technology
1 answer:
mixer [17]2 years ago
4 0

Answer: See below

Explanation:

<u>Description:</u> In this program, read-option from the user and based on that, perform the operation. And display the balance if the balance is negative.

<u>transactions.py</u>

balance = 1000

#read options from the user

option = input("Deposit or withdrawal: ")

amount = 0

#check if option is a withdrawal

if option == 'withdrawal':

amount = int(input("Enter an amount: "))

balance = balance - amount

#check option is deposit

elif option == 'deposit':

amount = int(input("Enter an amount: "))

balance = balance + amount

else:

print("Invalid transaction.")

#check balance is less than 0 (negative)

if balance < 0:

print("You cannot have a negative balance!")

else:

print("Final balance:",balance)

You might be interested in
unittttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
alukav5142 [94]
What the hell is the point of this, just to waist people's time?
5 0
3 years ago
What is the best data type for traveling day?
kykrilka [37]
Here if its wrong sorry

7 0
2 years ago
Which one of the following devices would you choose to meet those requirements?
tensa zangetsu [6.8K]
What are the requirements
5 0
2 years ago
Read 2 more answers
Insurance can help you:
AleksAgata [21]
The answer is: D for sure 
7 0
4 years ago
Explain Spreadsheet and its Basics
Aleks [24]

Explanation:

Microsoft Excel is a spreadsheet program included in the Microsoft Office suite of applications. Spreadsheets present tables of values arranged in rows and columns that can be manipulated mathematically using both basic and complex arithmetic operations and functions.

8 0
3 years ago
Other questions:
  • The main thing that adjusting the aperture controls when taking an image is?
    15·1 answer
  • What new information, strategies, or techniques have you learned that will increase your technology skills? Explain why its impo
    7·1 answer
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog?
    13·2 answers
  • What does psychologist Edward Spector mean when he says “ We have an entire generation of guinea pigs in an experiment”?
    14·1 answer
  • COMPUTER SCIENCE:PIXELS
    5·1 answer
  • Carrie works on a help desk and is assigned a ticket that was automatically generated by a server because of an error. The error
    14·2 answers
  • Reed Hastings created Netflix. His inspiration came from the fact that he had to pay a sizeable late fee for returning a DVD bey
    12·1 answer
  • Satırlar ve sütunların kesişmesiyle oluşan kutular aşağıdakilerden hangisidir
    15·1 answer
  • What is media ethics. Explain two forms of maintaining media ethics with examples​
    13·1 answer
  • A serial schedule:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!