Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
JAVA Assignment import java.util.Scanner: import edu.ids.model.LoanBean; public class LoanCalculator f public static void main(String) args) ( TODO Auto-generated method stub Scanner scanner- new Scanner Syste.in)
JAVA Assignment
import java.util.Scanner: import edu.ids.model.LoanBean; public class LoanCalculator f public static void main(String) args) ( TODO Auto-generated method stub Scanner scanner- new Scanner Syste.in) String status double principa LAnount 8.8: double downpayment::8.8; int LoanTerm- 0; double interestRate-e.8; LoanBean loanBean = new LoanBean(); // default constructor while(true) / user input try t System.out.printIn"Enter Principal Anount:" picipaLAnount- scanner.nextDoub le) System.out.printIn("Enter Down Payment: " downPayment scanner.nextDouble) System.out.printIn("Enter Loan Term (in years) ) LoanTerm = scanner.nextInt(); System.out.printn("Enter Interest Rate (per year):") interestRate scanner.nextint); LoanBean.setPrincipaLAmount (principaLAnount): LoanBean. setDownPayment (downPayment); LoanBean.setLoanTerm(loanTerm) LoanBean.setInterestRate(interestRate) status- loanBean.computeLoan) / output results System.out.printn("Financed Amount is s" loanBean.getFinancedAmountFormat)) System.out.println"Monthty Payment is $" loanBean.getMonthlyPaymentFormat)) System.out.println(Total Payments is $" loanBean.getTotaLPaymentsFormato); System.out.printnTotat Interest is"loanBean.getTotaLInterestFormat)) System.out.printIn"Total Cost System.out.printIn"Status" status +" " is $" + loanBean.getTotalCostFornatn") catch (Exception e) System.out.printn("Error! Invalid number. Try again. " scanner.next) System.out.println("Do you wish to continue (y)?"); if(scanner.next).equalsIgnoreCase("n")) break: System.out.printIn) scanner.close) Loan Calculator Array Continuing with the loan calculator assignment, extend it as follows: 1. 2. 3. Prompt the user for the number of loans they wish to analyze. Based on the number of loans instantiate an array of type LoanBean Loop through the specified number of loans a. Obtain a new instance of the LoanBean class using the default constructor, adding that instance to the array from step 2. b. Prompt the user for the inputs for principal amount, down payment, loan term, and interest rate, setting these values in the loan bean class instance. c Invoke the compute loan method for this instance of the loan bean. d. Display the results for this instance Display in tabular format full results as shown in class, including input values and computed results. 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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