This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomer_banking.py
37 lines (30 loc) · 1.85 KB
/
customer_banking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Import the create_cd_account and create_savings_account functions
from savings_account import create_savings_account
from cd_account import create_cd_account
# Define the main function
def main():
"""This function prompts the user to enter the savings and cd account balance, interest rate,
and the length of months to determine the interest gained.
It displays the interest earned on the savings and CD accounts and updates the balances.
"""
# Prompt the user to set the savings balance, interest rate, and months for the savings account.
savings_balance = float(input("Savings balance: "))
savings_interest = float(input("Interest rate: "))
savings_maturity = float(input("Months: "))
# Call the create_savings_account function and pass the variables from the user.
updated_savings_balance, interest_earned = create_savings_account(savings_balance, savings_interest, savings_maturity)
# Print out the interest earned and updated savings account balance with interest earned for the given months.
print(f"Interest earned: ${interest_earned:.2f}")
print(f"Updated savings account balance: ${updated_savings_balance:.2f}")
# Prompt the user to set the CD balance, interest rate, and months for the CD account.
cd_balance = float(input("CD balance: "))
cd_interest = float(input("Interest rate: "))
cd_maturity = float(input("Months: "))
# Call the create_cd_account function and pass the variables from the user.
updated_cd_balance, interest_earned = create_cd_account(cd_balance, cd_interest, cd_maturity)
# Print out the interest earned and updated CD account balance with interest earned for the given months.
print(f"Interest earned: ${interest_earned:.2f}")
print(f"Updated CD account balance: ${updated_cd_balance:.2f}")
if __name__ == "__main__":
# Call the main function.
main()