Question
// Starter Code // ******************************************************** import java.util.Scanner; public class HW3_SimpleLoanCalculator { public static void main(String[] args){ Scanner input = new Scanner(System.in); // annual interest rate(input)
// Starter Code // ******************************************************** import java.util.Scanner;
public class HW3_SimpleLoanCalculator {
public static void main(String[] args){ Scanner input = new Scanner(System.in);
// annual interest rate(input) final double ANNUAL_INTEREST_RATE; System.out.print("Enter annual interest rate: "); ANNUAL_INTEREST_RATE = input.nextDouble(); // DO NOT CHANGE THE CODE ABOVE ----------------------------
// loan amount (input) System.out.print(" Enter loan amount: "); input.nextDouble();
// term of loan in years (input) System.out.print(" Enter term of loan in years: "); input.nextDouble();
// Other variables and calculations
// Display output, do not change the text below. System.out.println(" HW-3 Simple Loan Calculator" ); System.out.println("If you request a loan and borrow $" ); System.out.println("at an annual interest rate of " ); System.out.println("and the duration of the loan is " + " years" ); System.out.println("you pay interest in the amount of: " ); System.out.println("and you will repay a total of: " ); } }
JAVA HW-3: Simple Loan Calculator Complete the following program. Input: Loan Details - loan amount - annual interest rate - duration of the loan in years Note: input is done automatically CodeRunner, see test cases below. Output: Interest paid - amount of interest paid - total amount repaid Hints: - Study the sample test cases shown below to better understand how your code should work. - See a similar (online) calculator here: https://www.webmath.com/simpinterest.html You want to calculate the interest on $19000 at 2.5% interest per year after 5 year(s). The formula we'll use for this is the simple interest formula, or: I=Prt Where: - P is the principal amount, $19000.00. - r is the interest rate, 2.5% per year, or in decimal form, 2.5/100=0.025. - t is the time involved, 5....year(s) time periods. - So, t is 5....year time periods. To find the simple interest, we multiply 190000.0255 to get that: Usually now, the interest is added onto the principal to figure some new amount after 5 year(s), or 19000.00+2375.00=21375.00. For example: - If you borrowed the $19000.00, you would now owe $21375.00 Por ejemplo: \begin{tabular}{|l|l|} \hline Entrada & Resultado \\ \hline 2.5 & Enterannualinterestrate:Enterloanamount:Entertermofloaninyears: \\ 5 & HW-3SimpleLoanCalculatorIfyourequestaloanandborrow$19000.0atanannualinterestrateof2.5andthedurationoftheloanis5.0yearsyoupayinterestintheamountof:2375.0andyouwillrepayatotalof:21375.0 \\ \hline 4.9 & Enterannualinterestrate:Enterloanamount:Entertermofloaninyears: \\ 10000 & HW-3SimpleLoanCalculatorIfyourequestaloanandborrow$10000.0atanannualinterestrateof4.9andthedurationoftheloanis1.0yearsyoupayinterestintheamountof490.0andyouwillrepayatotalof10490.0 \\ \hline \end{tabular}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