Question: Demonstrate that you know how to define variables in a program, create conditional statements, write a loop, obtain input from the user, and display output.
- Demonstrate that you know how to define variables in a program, create conditional statements, write a loop, obtain input from the user, and display output.
Create a Loan Amortization Schedule based on user input. Allow the user to enter a loan amount, a number of years for the loan, and the annual interest rate. You must use the ReadIntegerFromUser and ReadFloatFromUser methods for user input (provided earlier in this course). Refer to the steps for tips on how to create this program. You must use printf in this program. Be sure to submit your .java program and a print-screen of your test results (25% of Test 1 Practical grade).
// Calculate monthly interest rate by dividing the annual interest rate by 1200
// Calculate monthly payment = loan amount * monthly rate /
( 1 - 1 / Math.pow(1 + monthlyRate, years * 12));
double monthlyPayment = loanAmount * monthlyRate /
(1 - 1 / Math.pow(1 + monthlyRate, years * 12));
// Calculate total payment as this: (monthly payment * 12) * NumberOfYears
// Display monthly payment
// Display total payment
// Create amortization schedule with the Payment#, Interest, Principal, and Balance
The output must be in this layout (be sure the payment #, interest, principal, and balance print on one line):
Your Name Loan Amortization Schedule
Enter Loan Amount:
10000
Enter Number of Years:
1
Enter Annual Interest Rate:
3.25
Monthly Payment: 848.08
Total Payment: 10176.91
Payment# Interest Principal Balance
1 27.08 820.99 9179.01
2 24.86 823.22 8355.79
3 22.63 825.45 7530.34
4 20.39 827.68 6702.66
5 18.15 829.92 5872.74
6 15.91 832.17 5040.57
7 13.65 834.42 4206.14
8 11.39 836.68 3369.46
9 9.13 838.95 2530.51
10 6.85 841.22 1689.29
11 4.58 843.50 845.79
12 2.29 845.79 -0.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
