Answer in Python: Show all code:
Modify the code used to solve the below question so that calcFinalBalance() returns the final balance to main(), and main() prints the final balance out:
Write a program that contains a main function and a called function called calcFinalBalance(). The main function asks the user for the amount of money to be deposited in a bank account, the interest rate, and the number of years it will be in that account. The interest rate should be given as a percentage such as 5 or 4.2 (and not .05 and .042.) The main function passes these values to calcFinalBalance(). The calcFinalBalance function calculates the final balance and prints out this value. Assume interest is paid annually.
.
check out the solution and do comment if any queries
------------------------------------------------
# called function
def calcFinalBalance(amount, rate, years):
# change the formula accordingly, program remains same
# simple interest = (principal * period * rate of
interest)/100
# final amount = principal + simple interest
interest = (amount * years * rate) / 100
balance = amount + interest
# return the balance
return balance
# main function
def main():
# get the user input
amount = float(input("Enter amount of money to be deposited in bank
: "))
rate = float(input("Enter annual rate of interest : "))
years = int(input("Enter the number of years amount will be in that
account : "))
# function call
balance = calcFinalBalance(amount, rate, years)
# print the returned result
print("\nFinal balance : ", balance)
# frequently python does not use main function..
# directly python executes the independent statements as the start
of python program
# as we have used main function, the below statements required to
call main function
if __name__== "__main__":
main()
---------------------------------------------------------

---------------------------------
OUTPUT ::

Answer in Python: Show all code: Modify the code used to solve the below question so...
Write a Python program which simulates how a bank account works. (1) create a global constant INTEREST_RATE as the interest rate, which is assigned value 0.01. (2) create a global variable balance, which is initialized to 1000. (3) define a function named deposit which takes no parameter, it asks user to enter the amount of money that will be deposited into this account, then updates the global variable balance (which should increase by the amount of the deposit) and prints...
For this lab, modify the python code below so it will continuously be asking user for inputs to calculate the interest earned until the user enters number 0 (zero) in principle. Once the user enters any number less or equal to 0 in principle, the program will end. here is my code: # Programming Exercise 3-14 # Local variables p = 0.0 r = 0.0 n = 0.0 t = 0.0 loop = True while loop: p = float(input('\nEnter the...
Please help me with the code. Thank you! Description James Vond has delivered us some intel that the enemy perpetrators have been tricked into going to a bank that we've wired and booby-trapped. However, we have not gotten a bank system in place and you are the only person who is capable of handling such a task. We need this plan to go off without a hitch because the money we'll be receiving will give us insight on the hideout's...
a. Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b. Modify the program in Exercise 3a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c. Modify the program in Exercise 3b so...
Write a program that does the following in Python Code: Stores the following three lists: last_name = ["Smith", "Jones", "Williams", "Bailey", "Rogers", "Pyle", "Rossington"] first_name =["Lisa", "Bill", "Jay", "Sally", "Walter","Jake","Gary"] phone_number =["240-233-1921", "301-394-2745", "571-321-8934", "703-238-3432", "703-947-9987", "301-945-3593", "240-671-3221"] Has a function named combine_lists() that takes in last_names, first_names and phone_numbers as lists and returns a dictionary called phone_book that uses last_name as the key and a list consisting offirst_name and phone_number. Has a main function that iterates through the phone_book...
Write a program that does the following in Python Code: Stores the following three lists: last_name = ["Smith", "Jones", "Williams", "Bailey", "Rogers", "Pyle", "Rossington"] first_name =["Lisa", "Bill", "Jay", "Sally", "Walter","Jake","Gary"] phone_number =["240-233-1921", "301-394-2745", "571-321-8934", "703-238-3432", "703-947-9987", "301-945-3593", "240-671-3221"] Has a function named combine_lists() that takes in last_names, first_names and phone_numbers as lists and returns a dictionary called phone_book that uses last_name as the key and a list consisting of first_name and phone_number. Has a main function that iterates through the...
Write a program in Python that computes the interest accrued on an account. You can modify the “futval.py” program given in Chapter 2 to accomplish it. Your program should use a counted loop rather than a formula. It should prompt the user to enter the principal amount, the yearly interest rate as a decimal number, the number of compounding periods in a year, and the duration. It should display the principal value at the end of the duration. To compute...
Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...
Code in C++ Modify “Producer and Consumer Problem” from lecture note so that it can use all buffer space, not “buffersize – 1” as in the lecture note. This program should work as follows: 1.The user will run the program and will enter two numbers on the command line. Those numbers will be used for buffersize and counter limit. 2. The program will then create a separate threads, producer and consumer thread. 3. Producer thread generates a random number through...
This is Python Coding question. Can anyone help me figuring these out? (Please don't use built-in function, and leave comments for my understanding) Thanks!! 1. Write a function called span(n) that takes as a parameter a 2D list of numbers called n and returns the difference between the largest and smallest number in n. For example, it should return the value 6 for the list [[2, 1, 3],[3, 7, 4]] since the largest number is 7 and the smallest is...