PROGRAM #4 (AMORTIZATION WITH A MENU)



[pic]

ITP132 Lab 7 (Due: November 28, 2017) Name: __________________________________________

Loan Table Generator (Java application) (has neither given nor received aid on this program)

Problem:

Prepare a C++ application program to generate a useful and practical table to aid its user in calculating the monthly payments for any loan with interest rates from 0.0% to 24.0% in increments of 0.5%. By columns the table should indicate the following loan terms: 1, 2, 3, 4, 5, 6, & 7 years. Have your program calculate the loan payment based on $1,000 so later, the user may multiply one of these table values by fractional parts of $1,000 to instantly calculate the loan payment. For example: $32,250 borrowed at 8.0% for 72 months. The user multiplies 32.25 (the multiple of $1,000) by the table value of 17.5332. This produces a monthly payment of $565.45 per month. Regular payments in this period will fully amortize the loan amount.

Required Techniques:

a) Two constructors (overloaded) will be used in this program. The default constructor will be used to create the table, and the constructor with three parameters will be used to calculate only one monthly payment.

b) The use of a field private final double AMOUNT = 1000.0; will be demonstrated in this program to be used in any class method as the original loan amount.

c) The student will write the JAVA source code for a method that returns a double to calculate individual loan payments. Students may later use this method to create a more complex amortization program. This method will prevent division by zero by conditionally calculating the 0.0% interest payment. Note: the periodic (monthly) interest is:

i = yearlyInterest / 12.0;

d) A “nested loop” will be used for this row/column technique, where the outer loop generates each interest rate (0.0% – 24.0% in 0.5% increments) from an integer loop value (more details will discussed in class).

e) From now on, our public static void main(String[] args) method will be “clean” and first create the table using the default constructor. Then, call its three parameter constructor to produce only one payment. Assign three variables before calls to constructors: years = 5, principle = 8932.51, and yInterest = 0.08 (representing 8% yearly interest).

f) The program will generate a title with his/her name and examples, a table, and the one calculated payment for paragraph (e) on the console. Then you will simply copy the screen and paste it onto the file "Lab7.txt".

g) The output must be generated exactly as described in the Print Spacing Chart provided.

Formula Information: The piecewise formula for a fully amortized loan payment is:

payment = AMOUNT * ( i / ( 1 – ( 1 + i ) –n ) )

Where payment represents the periodic (monthly) payment of the loan

" AMOUNT represents the amount financed

" i represents the periodic (monthly) interest rate > 0 (see requirement (c) above)

" n represents the number of periods in the term (eg. 5 years is 60 months; n = 60 here)

Note: if i == 0, use the formula: payment = AMOUNT / n

Checklist:

Your required items to submit: this signed specification sheet, heavily commented source code, print spacing chart you made, and a hard copy of your program’s output.

Submitted:

Electronically & Hard Copies submitted, in the usual way: Lab7.java, Lab7.psc, Lab7.txt

Jeff's Loan Calculator Table

------ ---- ---------- -----

This table calculates periodic monthly payments for each $1,000 borrowed.

Example: $32,250 borrowed at 8.0% for 72 months: 32.25 x 17.5332 = $565.45

Example: $32,250 borrowed at 0.0% for 60 months: 32.25 x 16.6667 = $537.50

1 yr 2 yr 3 yr 4 yr 5 yr 6 yr 7 yr

0.0% 83.3333 41.6667 27.7778 20.8333 16.6667 13.8889 11.9048

0.5% 83.5592 41.8840 27.9924 21.0467 16.8793 14.1012 12.1168

1.0% 83.7854 42.1021 28.2081 21.2615 17.0937 14.3155 12.3312

1.5% 84.0120 42.3208 28.4248 21.4776 17.3099 14.5319 12.5481

2.0% 84.2389 42.5403 28.6426 21.6951 17.5278 14.7504 12.7674

2.5% 84.4661 42.7604 28.8614 21.9140 17.7474 14.9710 12.9892

3.0% 84.6937 42.9812 29.0812 22.1343 17.9687 15.1937 13.2133

3.5% 84.9216 43.2027 29.3021 22.3560 18.1917 15.4184 13.4399

4.0% 85.1499 43.4249 29.5240 22.5791 18.4165 15.6452 13.6688

4.5% 85.3785 43.6478 29.7469 22.8035 18.6430 15.8740 13.9002

5.0% 85.6075 43.8714 29.9709 23.0293 18.8712 16.1049 14.1339

5.5% 85.8368 44.0957 30.1959 23.2565 19.1012 16.3379 14.3700

6.0% 86.0664 44.3206 30.4219 23.4850 19.3328 16.5729 14.6086

6.5% 86.2964 44.5463 30.6490 23.7150 19.5661 16.8099 14.8494

7.0% 86.5267 44.7726 30.8771 23.9462 19.8012 17.0490 15.0927

7.5% 86.7574 44.9996 31.1062 24.1789 20.0379 17.2901 15.3383

8.0% 86.9884 45.2273 31.3364 24.4129 20.2764 17.5332 15.5862

8.5% 87.2198 45.4557 31.5675 24.6483 20.5165 17.7784 15.8365

9.0% 87.4515 45.6847 31.7997 24.8850 20.7584 18.0255 16.0891

9.5% 87.6835 45.9145 32.0329 25.1231 21.0019 18.2747 16.3440

10.0% 87.9159 46.1449 32.2672 25.3626 21.2470 18.5258 16.6012

10.5% 88.1486 46.3760 32.5024 25.6034 21.4939 18.7790 16.8607

11.0% 88.3817 46.6078 32.7387 25.8455 21.7424 19.0341 17.1224

11.5% 88.6151 46.8403 32.9760 26.0890 21.9926 19.2912 17.3865

12.0% 88.8488 47.0735 33.2143 26.3338 22.2444 19.5502 17.6527

12.5% 89.0829 47.3073 33.4536 26.5800 22.4979 19.8112 17.9212

13.0% 89.3173 47.5418 33.6940 26.8275 22.7531 20.0741 18.1920

13.5% 89.5520 47.7770 33.9353 27.0763 23.0098 20.3390 18.4649

14.0% 89.7871 48.0129 34.1776 27.3265 23.2683 20.6057 18.7400

14.5% 90.0225 48.2494 34.4210 27.5780 23.5283 20.8744 19.0173

15.0% 90.2583 48.4866 34.6653 27.8307 23.7899 21.1450 19.2968

15.5% 90.4944 48.7245 34.9107 28.0849 24.0532 21.4175 19.5783

16.0% 90.7309 48.9631 35.1570 28.3403 24.3181 21.6918 19.8621

16.5% 90.9676 49.2024 35.4044 28.5970 24.5845 21.9681 20.1479

17.0% 91.2048 49.4423 35.6527 28.8550 24.8526 22.2461 20.4358

17.5% 91.4422 49.6828 35.9021 29.1144 25.1222 22.5260 20.7258

18.0% 91.6800 49.9241 36.1524 29.3750 25.3934 22.8078 21.0178

18.5% 91.9181 50.1660 36.4037 29.6369 25.6662 23.0914 21.3119

19.0% 92.1566 50.4086 36.6560 29.9001 25.9406 23.3767 21.6080

19.5% 92.3954 50.6519 36.9093 30.1646 26.2164 23.6639 21.9061

20.0% 92.6345 50.8958 37.1636 30.4304 26.4939 23.9528 22.2062

20.5% 92.8740 51.1404 37.4188 30.6974 26.7729 24.2435 22.5082

21.0% 93.1138 51.3857 37.6751 30.9657 27.0534 24.5360 22.8122

21.5% 93.3539 51.6316 37.9323 31.2353 27.3354 24.8302 23.1181

22.0% 93.5944 51.8782 38.1905 31.5061 27.6189 25.1261 23.4259

22.5% 93.8352 52.1254 38.4496 31.7782 27.9039 25.4238 23.7356

23.0% 94.0763 52.3733 38.7097 32.0515 28.1905 25.7231 24.0472

23.5% 94.3178 52.6219 38.9708 32.3260 28.4785 26.0241 24.3606

24.0% 94.5596 52.8711 39.2329 32.6018 28.7680 26.3268 24.6758

Calculating a monthly payment to borrow $8932.51 @ 8.00% for 5 years $181.12

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download