Project: Comparing Loans Problem Description: Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest...

1 answer below »


Project: Comparing Loans


Problem Description:


Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of 1/8. Here is a sample run:




Loan Amount: 10000


Number of Years: 5



Interest Rate Monthly Payment Total Payment


5.000% $188.71 $11,322.74


5.125% $189.28 $11,357.13


5.250% $189.85 $11,391.59


...


7.875% $202.17 $12,129.97


8.000% $202.76 $12,165.83




Use the formulas below to compute monthly payment and total payment.




























Design:
(Describe the major steps for solving the problem.)




Coding:
(Copy and Paste Source Code here. Format your code using Courier 10pts)




Output screenshot:
(Paste your output screenshot here)






Testing:
(Describe how you test this program)




Submit the following items:



1. This Word document and Submit to Moodle (you must submit the program regardless whether it complete or incomplete, correct or incorrect)


Hint:


1. Can you get the first four rows manually? This will help you understand how to compute the numbers mathematically.


2. Can you write a program to produce the first four rows? This will help you see the pattern.


3. Can you generalize it in a loop to produce all the rows?


4. Finally, format the output correctly.


Answered Same DayJan 17, 2021

Answer To: Project: Comparing Loans Problem Description: Write a program that lets the user enter the loan...

Neha answered on Jan 17 2021
137 Votes
74643 - java interest code/main.java
74643 - java interest code/main.java
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        S
canner input = new Scanner(System.in);
        System.out.print("Loan Amount: ");
        double loanAmount = input.nextDouble();
        System.out.print("Number of Years: ");
        int numberOfYears = input.nextInt();
        System.out.println("Interest Rate    Monthly Payment    Total Payment");
        for (double i = 5.0; i <= 8; i += 0.125) {
            System.out.printf("__________________________________________________\n");
            System.out.printf("%-5.3f", i);
            System.out.print("%           ");
            double monthlyInterestRate = i / 1200;
            double monthlyPayment = loanAmount * monthlyInterestRate / (1
                - 1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12));
            System.out.printf("$%-19.2f", monthlyPayment);
            System.out.printf("$%-8.2f\n",(monthlyPayment * 12) * numberOfYears);
        }
    }
}
74643 - java interest code/mits4002activity07-hjjfbds5.docx
        
        MITS4002
OBJECT-ORIENTED SOFTWARE DEVELOPMENT
Activity 07
Weightage: 5%
Due date: Friday Lesson 08 5PM
        Late penalty applies on late submission, 10% per day would be deducted
0 mark for LATE Submission more than one week
        You will be marked based on your submitted zipped file on Moodle. You are most welcome to check your file with your lab tutor before your submission. No excuse will be accepted due to file corruption, absence from lecture or lab classes where details of lab requirements may be given.
Please make sure that you attend Lecture EVERY WEEK as low attendance may result in academic penalty or failure of this...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here