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
A. Modify the FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating,
Elenna [48]

Answer:

It keeps saying servers fully loaded

Explanation:

5 0
2 years ago
Individuals and IT professionals have a responsibility to be aware of security threats and the damage they might do.
Veseljchak [2.6K]
The answer is true they will have to be responsible
6 0
2 years ago
Company that offers Internet access to individuals and businesses. This device connects two or more networks and directs the flo
Ganezh [65]

Answer:

ISP is the correct answer to the following question.

Explanation:

ISP(Internet Service Provider) is the company or an organization which provides the internet connection or access to any persons, individuals or any company. It is the device that connects networks and direct flow of the data or information through the network. If you want to connect through ISP then, you have to connect this device to the computer system.

5 0
3 years ago
What is the ascii code for the letter D
PilotLPTM [1.2K]

Answer:

068

Explanation:

Or if you want binary it's 01000100

4 0
2 years ago
Jonathan created a presentation for his workplace. He now wants to embed an audio file in the presentation. Which file format sh
viva [34]

Answer:

He can use any of the audio formats like MP3 and M4A.

Explanation:

6 0
3 years ago
Other questions:
  • Match terms in the first column with the order descriptions in column two.
    11·1 answer
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • What is an identified component of a software program that might allow a hacker or other intruder to gain entry and control of a
    10·2 answers
  • Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video a
    9·1 answer
  • HELP ASAP 10 POINTS COMPUTER SCIENCE
    14·2 answers
  • Who's hype for Halo Infinite?
    11·2 answers
  • Will mark Brainliest!! What is the best memory to use on a computer? Why?
    9·1 answer
  • Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bu
    13·1 answer
  • What problems do you see in the process of transacting business online
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!