Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Python for this question. A new online store growing in popularity is called You definitely Need This!!. The store tells their customers Saving

Please use Python for this question.

A new online store growing in popularity is called "You definitely Need This!!". The store tells their customers Saving is for suckers! The store loans customers money to buy a product, and the customer must pay off the loan over time. The store's repayment plan has the following rules and definitions:

Purchase price

The initial cost of the product.

Down Payment

A one-off payment at the beginning of the loan, which can be anything up to 10% of the purchase price.

Monthly Repayments

Repayments must be made every month. Repayments are fixed at 6% of the purchase price for payments over $200, otherwise 10%. Each month's payment includes some of the original loan, and some interest. For example, if the purchase price is $100, then each monthly repayment will be $10, including interest.

Opening & Closing Balance

The size of the loan at the start of a month is referred to as the opening balance, and the size of the loan at the end of a month is the closing balance. For instance, if the closing balance in January is $10, then the opening balance in February is $10. (The opening/closing balance do not include interest.)

Interest

There is an annual interest rate of 18%, and interest is calculated and paid monthly. The amount of interest to repay each month is calculated as

interest = opening balance * 0.18 / 12

Principal

The principal is the amount of the original loan repayed each month. In other words,

principal = repayment - interest

Write a program that takes as input: (1) the purchase price (a float); (2) the down payment (a float) no greater than 10% of the purchase price. The program must print a table, with appropriate headers, of the payment schedule for the lifetime of the loan, not including the down payment. The columns of the table, and their widths, are as follows:

Month (7 spaces wide)

The month number, beginning from 1

Opening Bal (13 spaces wide)

The opening balance for the month

Interest (10 spaces wide)

The interest paid for the month

Principal (11 spaces wide)

The principal paid for the month

Repayment (11 spaces wide)

The total repayment for the month

Closing Bal (13 spaces wide)

The closing balance for the month

Notes:

You should round the closing balance and the interest to 2 decimal places when you calculate them each month. To do this, use Python's round function:

unrounded = 83.82345
rounded = round(unrounded, 2)
print(rounded)
  • The final repayment will be smaller than the other repayments (see the final month of the example tables below).
  • The monthly repayment must be at least $0.01, otherwise the loan might never be paid off!
  • Table entries are left-aligned, and every cell has one space padding on the left and right. If an entry in the table contains more digits than fit in the column, the column should expand to fit the number, along with one space padding on either side.
  • You can assume the price and down payment will be integers of value 0 or higher. If you user enters a price of 0, output "Lucky you, this product is FREE!!"

image text in transcribed

image text in transcribed

image text in transcribed

Enter purchase price (0): 100 Enter a Down payment ) (no money, just enter 0): 10 Month | Opening Bal | Interest | Principal Repayment | Closing Bal 90.00 81. 35 72. 57 63. 66 54. 61 45. 43 36.11 26. 65 17. 05 7. 31 1. 35 1. 22 1. 09 0.95 0. 82 0. 68 0. 54 0. 40 0. 26 8. 65 8. 78 8.91 9. 05 9.18 9. 32 9. 46 9. 60 9. 74 7. 31 10.00 10. 00 10. 00 10.00 10. 00 10. 00 10. 00 10.00 10. 00 7. 42 81. 35 72. 57 63. 66 54. 61 45. 43 36.11 26. 65 17. 05 7. 31 0.00 10 Enter purchase price ($): 25980 Enter a Down payment ) (no money, just enter 0): 0 Month | Opening Bal | Interest | Principal Repayment | Closing Bal 25980.00 24810.90 23624. 26 22419. 82 21197. 32 19956. 48 18697. 03 17418. 69 16121.17 14804. 19 13467.45 12110. 66 10733. 52 9335. 72 7916. 96 6476. 91 5015. 26 3531. 69 2025. 87 497. 46 389. 70 372. 16 354. 36 336. 30 317.96 299. 35 280. 46 261.28 241. 82 222. 06 202. 01 181. 66 161.00 140. 04 118. 75 1169. 10 1186. 64 1204.44 1222. 50 1240. 84 1259. 45 1278. 34 1297. 52 1316.98 1336. 74 1356. 79 1377. 14 1397. 80 1418. 76 1440. 05 1461. 65 1483. 57 1505. 82 1528. 41 497. 46 1558. 80 1558.80 1558. 80 1558. 80 1558.80 1558.80 1558. 80 1558. 80 1558.80 1558.80 1558. 80 1558. 80 1558.80 1558.80 1558. 80 1558. 80 1558.80 1558.80 1558. 80 504.92 24810. 90 23624. 26 22419. 82 21197. 32 19956. 48 18697. 03 17418. 69 16121.17 14804. 19 13467.45 12110. 66 10733. 52 9335. 72 7916. 96 6476. 91 5015. 26 3531. 69 2025. 87 497. 46 75. 23 52.98 30. 39 Enter purchase price ($) 50 Enter a Down payment ) (no money, just enter 0): 25 No, no, no!! Maximum amount you need to pay upfront is $5. 00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions