234k views
1 vote
Shady lady Mortgage Company requires an insurance down payment on all its mortgages based on the

following schedule:
5% on the first $25,000
3% on the remaining balance Develop the logic required for a program to computer the down payment requires by the mortgagee and list the mortgagee's account number and name. The input data record will contain name, account number,
and mortgage amount. Use functions. Add comments and use the output formatting for the
currency.
Please I somebody to write me a code out please!

User Romeozor
by
8.2k points

1 Answer

4 votes
Certainly! Here's a Python code that will calculate the down payment required by Shady Lady Mortgage Company based on the mortgage amount:

```python
def calculate_down_payment(mortgage_amount):
if mortgage_amount <= 25000:
down_payment = mortgage_amount * 0.05
else:
down_payment = 25000 * 0.05 + (mortgage_amount - 25000) * 0.03
return down_payment

def main():
name = input("Enter your name: ")
account_number = input("Enter your account number: ")
mortgage_amount = float(input("Enter your mortgage amount: "))

down_payment = calculate_down_payment(mortgage_amount)

print("Name:", name)
print("Account number:", account_number)
print("Mortgage amount: ${:,.2f}".format(mortgage_amount))
print("Down payment: ${:,.2f}".format(down_payment))

if __name__ == "__main__":
main()
```

When you run this code, it will ask you to enter your name, account number, and mortgage amount. The `calculate_down_payment` function will then calculate the down payment required based on the mortgage amount entered. Finally, the program will output the name, account number, mortgage amount, and down payment required in the correct format.
User PerplexingParadox
by
7.5k points