Question: public class ModLoan { private int loanNumber;// a six-digit integer with no leading zeros in it private double loanAmount;// amount borrowed for mortgage private double

 public class ModLoan { private int loanNumber;// a six-digit integer withno leading zeros in it private double loanAmount;// amount borrowed for mortgageprivate double interestRate ;// annual interest rate (i.e. 4.5 for 4.5%) privateint termMonths;// loan term in months public ModLoan() { loanNumber=111111; termMonths=360; interestRate=0.0;loanAmount=0.0; } //overload constructor public ModLoan(int loanNumber,double loanAmount,double interestRate,int termMonths) { this.interestRate=interestRate; this.loanAmount= loanAmount; this.loanNumber= loanNumber; this.termMonths= termMonths; } //setter public void setLoanNumber(int

public class ModLoan { private int loanNumber;// a six-digit integer with no leading zeros in it

private double loanAmount;// amount borrowed for mortgage

private double interestRate ;// annual interest rate (i.e. 4.5 for 4.5%)

private int termMonths;// loan term in months public ModLoan() { loanNumber=111111; termMonths=360; interestRate=0.0; loanAmount=0.0; } //overload constructor public ModLoan(int loanNumber,double loanAmount,double interestRate,int termMonths) { this.interestRate= interestRate; this.loanAmount= loanAmount; this.loanNumber= loanNumber; this.termMonths= termMonths; } //setter

public void setLoanNumber(int loanNumber) { this.loanNumber = loanNumber; }

public void setInterestRate(double interestRate) { this.interestRate = interestRate; }

public void setLoanAmount(double loanAmount) { this.loanAmount = loanAmount; }

public void setTermMonths(int termMonths) { this.termMonths = termMonths; } //getters

public double getInterestRate() { return interestRate; }

public double getLoanAmount() { return loanAmount; }

public int getLoanNumber() { return loanNumber; }

public int getTermMonths() { return termMonths; } public double computeMonthlyPayment() { double interestRate1 = interestRate/100; interestRate1 = interestRate1/12; double Factor = Math.exp(termMonths*Math.log(1+interestRate1)); double payment = (Factor*interestRate1*loanAmount)/(Factor-1); return payment; } public double computeTotalInterest(double monthlyLoanPayment) { double totalInterest = (monthlyLoanPayment*termMonths)-loanAmount; totalInterest = Math.round(totalInterest * 100) / 100.00; return totalInterest; } public void displayLoanTerms() { System.out.println("Loan "+loanNumber+" is for $"+String.format("%.02f",loanAmount) +" at "+String.format("%.02f",interestRate)+"% APR, to be paid over "+termMonths+" month(s)."); } }

Problem Summary The home mortgage loan company that you wrote the Topic 11 program for would like you to expand the program to process a data file. They would like to have a program that will help them determine how much money they will earn in interest from a set of loans they have issued Each line of the data file will contain a loan number, a loan amount, an annual interest rate, and a loan term. Test Data Files (included in the zyLab) loanData1.txt 112233 200000 6.5 360 445566 155555 5.25 240 loanData2.txt 222222 222222 2.22 240 333333 300000 3.3 360 444444 340000 4.44 180 555555 350000 5 300 You will write a program to: Read data from a file and determine the total interest paid on each loan NOTE: You may assume all file data will be valid (no error checking necessary) * Provide a report on the loan company profits. Each step of the instructions is associated with specific zyLab tests, so you can test your program as you develop it. The incremental steps will do the following: . Read data from one line of a data file, instantiate a Loan object, and display the data in the object e Read data from all lines of a data file and display the data for each Loan object Display a message with the number of lines read * Compute monthly payments and interest paid for each loan object Total the interest paid on all loan obiects * Implement exception handling if the input file cannot be opened Create an output file, logging the interest paid on each loarn

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!