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
HACTEHA [7]
3 years ago
5

Write a Python program to balance a checkbook. The main function needs to get the initial balance, the amounts of deposits, and

the amounts of checks. Allow the user to process as many transactions as desired; use separate functions to handle deposits and checks.
Computers and Technology
1 answer:
Irina18 [472]3 years ago
5 0

Answer:

def deposit(deposit_amount, balance):

   balance += deposit_amount

   return balance;

def process_check(check_amount, balance):

   balance -= check_amount

   return balance;

balance = float(input("Enter the initial balance: "))

transaction = input("Choose transaction method - D to deposit, C to process check, Q to quit: ")

while transaction != 'Q':

   if transaction == 'D':

       deposit_amount = float(input("Enter amount to be deposited: "))

       balance = deposit(deposit_amount, balance)

       print("Current balance is: " + str(balance))

   elif transaction == 'C':

       check_amount = float(input("Enter amount to process check: "))

       if balance >= check_amount:

           balance = process_check(check_amount, balance)

           print("Current balance is: " + str(balance))

       else:

           print("Not enough money!")

   else:

       print("Invalid input!")

   transaction = input("Choose transaction method - D to deposit, C to process the check, Q to quit: ")

print("Your final balance is: " + str(balance))

Explanation:

- Create functions to handle deposits and checks

- Ask the user for the initial balance and transaction to be made

- Initialize a while loop iterates until the user enter Q

- Ask the deposit amount or check amount depending on the transaction chosen

- Calculate and print the current balance for each transaction

- Print the final balance

You might be interested in
1) The critical path of a network is the A) shortest time path through the network. B) path with the fewest activities. C) path
german

Answer:

D

Explanation:

source

https://hbr.org/1963/09/the-abcs-of-the-critical-path-method

7 0
3 years ago
Which Tab provides the command to add a hyperlink to a document?
Natali [406]

Answer:

I love it is your responsibility is accepted the second one was for the database reply to your account we should wear the same same Dp xd I have tow bar is the only one hour u

7 0
3 years ago
Read 2 more answers
What does the action tool allow you to do in Microsoft power point?
pickupchik [31]
I believe the answer is A. Add animation to clip art and text 
6 0
3 years ago
Which question best addresses the issue of risk with a new job?
jolli1 [7]
The last answer seems most appropriate
5 0
4 years ago
Read 2 more answers
What do developers do to support software products? explain to users which development process model was used to make the produc
cestrela7 [59]

Answer:

The developer develops the user manuals to support their products. And agile development process is being used to make the user manual. The technical write this, but they first talk to developers, designers, project managers, team leaders etc. and collect all the information from them. And they start making them since start of the project. They use jira, git and various version control to update this document. And all the functionalities must be mentioned accurately, as well as latest of them to ensure reliability and credibility. Devops is another automated technology being used extensively these days.

Explanation:

The answer is self explanatory.

8 0
3 years ago
Other questions:
  • What variation of a dictionary attack involves a dictionary attack combined with a brute force attack, and will slightly alter d
    9·1 answer
  • It is advised to always have discretion with leaders. Explain in general terms what information security policies can and cannot
    12·1 answer
  • What two items must be given to the socket function in order to create a socket object? A) The socket type that will be used. B)
    10·1 answer
  • What is responsible for recording an image of an object with camera <br> Pls I neeed it right know
    8·1 answer
  • Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
    9·1 answer
  • ((Sorry for the self promo btw) Can you guys help me try and get affiliate on twitch? I am currently at 20 followers and it woul
    10·2 answers
  • It is important to consider the quality of the data being used when considering the accuracy of a conclusion. Incorrectly collec
    11·2 answers
  • Give five example of a dedicated device ​
    9·2 answers
  • Intro Programming - Problem(s)
    14·1 answer
  • How does ludonarrative apply to game design
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!