Lab 3 Tasks
Lab 3 Tasks
15.
The monthly installment for a specific loan covers both the principal and the interest. The
monthly interest is calculated by taking the monthly interest rate and multiplying it by the
balance (the outstanding principal). The principal amount paid for the month is thus the
monthly payment minus the monthly interest. Create a program that allows the user to
input the loan amount, specify the number of years, and interest rate, then present the loan
repayment schedule for the loan. Here is a sample run:
Sample input:
Loan Amount: 10000
Number of Years: 1
Annual Interest Rate: 7
Sample output:
Monthly Payment: 865.26
Total Payment: 10383.21
16. Write a Java program that lets the user enter the loan amount and loan period in number
of years. Then displays the monthly and total payments for each annual interest rate
starting from 5% to 8%, with an increment of 1/8%. Here is a sample run:
Sample input:
Loan Amount: 10000
Number of Years: 5
Sample output:
Interest Rate Monthly Payment Total Payment
5.000% 188.71 11322.74
5.125% 189.29 11357.13
5.250% 189.86 11391.59
………… ………. …………
7.875% 202.17 12129.97
8.000% 202.76 12165.84
Write a test program that reads in n (an integer variable) integers, invokes the method,
and displays the result. Here is the sample run of the program:
Enter number of integers n=10
Enter 10 numbers: 1 2 3 2 1 6 3 4 5 2
The distinct numbers are: 1 2 3 6 4 5
7. Write a method that takes an array of integers input. And returns a random number
between 1 and 54, excluding the numbers passed in the argument. The method header is
specified as follows:
public static int getRandom(int... numbers)