Question: JAVA OR JAVA FX, NO PICTURE CODE PLS Loan.java // Implements Seriablizable to support object IO public class Loan implements java.io.Serializable { private double annualInterestRate;

JAVA OR JAVA FX, NO PICTURE CODE PLS

JAVA OR JAVA FX, NO PICTURE CODE PLS Loan.java // Implements Seriablizable

Loan.java

// Implements Seriablizable to support object IO public class Loan implements java.io.Serializable { private double annualInterestRate; private int numberOfYears; private double loanAmount; private java.util.Date loanDate;

/** Default constructor */ public Loan() { this(2.5, 1, 1000); }

/** Construct a loan with specified annual interest rate, number of years and loan amount */ public Loan(double annualInterestRate, int numberOfYears, double loanAmount) { this.annualInterestRate = annualInterestRate; this.numberOfYears = numberOfYears; this.loanAmount = loanAmount; loanDate = new java.util.Date(); }

/** Return annualInterestRate */ public double getAnnualInterestRate() { return annualInterestRate; }

/** Set a new annualInterestRate */ public void setAnnualInterestRate(double annualInterestRate) { this.annualInterestRate = annualInterestRate; }

/** Return numberOfYears */ public int getNumberOfYears() { return numberOfYears; }

/** Set a new numberOfYears */ public void setNumberOfYears(int numberOfYears) { this.numberOfYears = numberOfYears; }

/** Return loanAmount */ public double getLoanAmount() { return loanAmount; }

/** Set a newloanAmount */ public void setLoanAmount(double loanAmount) { this.loanAmount = loanAmount; }

/** Find monthly payment */ public double getMonthlyPayment() { double monthlyInterestRate = annualInterestRate / 1200; double monthlyPayment = loanAmount * monthlyInterestRate / (1 - (Math.pow(1 / (1 + monthlyInterestRate), numberOfYears * 12))); return monthlyPayment; }

/** Find total payment */ public double getTotalPayment() { double totalPayment = getMonthlyPayment() * numberOfYears * 12; return totalPayment; }

/** Return loan date */ public java.util.Date getLoanDate() { return loanDate; } }

6.13 (Compare loans with various interest rates) Rewrite Programming Exercise I to create a GUI, as shown in Figure 16.41b. Your program should let the user enter the loan ar 5. 21 s, and it should display the monthly and total payments for each interest starting from 5% to 8%, with increments of one-eighth, in a text area. field rate

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!