Question
Create a Java application that calculates a loan payment based on the following formula: Payment = Amount of Loan * Interest Rate / 1-(1+Interest Rate)^-Months
Create a Java application that calculates a loan payment based on the following formula:
Payment = Amount of Loan * Interest Rate / 1-(1+Interest Rate)^-Months of loan
User input must follow the format (amount; rate; months). Hint: clean user input.
Requirements:
Obtain the input from user in "(Loan; rate; months)" format.
Extract variable values using substring and indexOf methods.
Clean loan amount and interest rate and convert to double types.
Convert annual percentage into monthly ratio (decimal value).
Accurately calculate monthly payment using provided formula
Monthly payment does not loose mathematical precision (two decimal points).
Display the loan terms and monthly payment.
Format amount as currency using NumberFormat.
Format interest rate as percent using NumberFormat.
Example of output is below:
Enter the terms of your car purchase in the following format: (Car Price; Annual Interest Rate; Loan Length in Months) Example: ($25,000.00; 2.99%; 60) Example: (25000.00; 2.99; 48) Example: ($30,000; 1.45%; 60) (25000.00; 1.49; 36) --------------------------------- ****************************************************************************** Car price (loan amount): $25,000.00 Annual Interest Rate: 1.49% Loan length in months 36 ---- Your monthly payment is: $710.51 ---- ******************************************************************************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started