QUESTION
Objectives include:Call and write methods with parameters and return values.Use the String and Scanner classes.Use if statements to validate input and control assignments.Hand-in RequirementsAll projects and laboratories will be submitted electronically through Blackboard.Zip up your entire project directory to submit as the source.(Right click on the project folder and follow 7-Zip > Add to “project2.zip”.)The project folder should include the following two files:LoanPaymentCal.javaLoanPaymentCalOutput.txtSample OutputHere is an example of what your output should look like for a loan amount of $300000 for 2 years.Project 2 written by Steve RobbinsEnter the loan amount and loan duration in years, for exampleamount 3000 years 2[DrJava Input Box]Loan amount: $300000.00Loan period: 2 yearsLoan rate: 3.5%Monthly payment: $12960.82Month Balance Payment Remaining1 300875.00 12960.82 287914.182 288753.93 12960.82 275793.123 276597.51 12960.82 263636.704 264405.64 12960.82 251444.825 252178.20 12960.82 239217.386 239915.10 12960.82 226954.287 227616.23 12960.82 214655.428 215281.50 12960.82 202320.689 202910.78 12960.82 189949.9710 190503.99 12960.82 177543.1711 178061.00 12960.82 165100.1912 165581.73 12960.82 152620.9113 153066.06 12960.82 140105.2414 140513.88 12960.82 127553.0615 127925.09 12960.82 114964.2816 115299.59 12960.82 102338.7717 102637.26 12960.82 89676.4418 89938.00 12960.82 76977.1819 77201.70 12960.82 64240.8820 64428.25 12960.82 51467.4421 51617.55 12960.82 38656.7322 38769.48 12960.82 25808.6723 25883.94 12960.82 12923.1224 12960.82 12960.82 0.00Total payment amount: $311059.60TasksCreate a directory called project2. Write a program called LoanPaymentCal and save it in project2. The program will printProject 2 written by YOURNAMEPrompt the user for an amount and a number of years. See below for details.Print the amount and number of years.Call a method loanRate that takes an input loan amount as a parameter and returns an interest rate. If a jumbo loan (a loan amount is greater than or equal to $350,000), use 4.0%. For a large loan (not jumbo but greater than or equal to $100,000), use 3.5%. Otherwise, the interest rate is 3.0%. No print statements should be included in this method. The main method will print the loan rate.Call a method loanMonthlyPayment that will take three parameters: the loan amount, rate, and number of years. It will return a monthly payment amount. This method should not print anything. The main method should print the monthly payment.Call a method loanTotalPayment that will take 4 parameters: the loan amount, monthly payment amount, rate and the number of years. It will return the total payment amount after printing a table like the one in the sample output. The main method should then print the total payment amount.DetailsThe ScannerYou will need to use Scanner to obtain input from the keyboard. You should declare a Scanner variable named console at the beginning of your main method. Only the main method will input from the keyboard.Input FormatInputting and verifying the input data is worth 5 points (25%). When writing you program, assume that two numbers will be entered, a double value giving the loan amount and an integer giving the loan duration in years. Use the console.nextDouble() and console.nextInt() to read in the values. This will give you 1 point out of 5 for this part of the assignment. Get the rest of the assignment working before coming back to this and improve the input handling of your program.To get the maximum of 5 points on this part of the assignment, your program must accept input as 4 tokens and verify that the input is in an appropriate format.The first token will be either “amount” or “years” (without the quotes). If the first token is “amount”, the next is the amount of the loan and should be read in using console.nextDouble(). If the first token is “years”, the next token is the number of years and should be read in with console.nextInt(). If the first token was “amount”, the third token should be “years” and the number of years is read in as the fourth token using console.nextInt(). If the first token was “years”, the third token should be “amount” and the amount should be read in with console.nextDouble(). Any other tokens are considered invalid input.If invalid input is detected, the program should print an appropriate message, explaining how the input is invalid. At that point it should exit the program. You can exit the program by calling return.You can get up to 4 points by following the above description. To obtain full credit you need to also validate the numeric input before you call console.nextInt() or console.nextDouble(). You can do this using the following Scanner methods:boolean hasNextInt(): returns true if the next token is a valid int.boolean hasNextDouble(): returns true if the next token is a valid double.A typical use of these might look like this:if (!console.hasNextInt()) {
ANSWER:
Place an order in 3 easy steps. Takes less than 5 mins.