Question: The task is to develop a loan calculator application using JavaFx event-driven programming with GUI. The major steps in developing the application are: Create the
The task is to develop a loan calculator application using JavaFx event-driven programming with GUI.
The major steps in developing the application are:
Create the user interface as shown below.
Create a GridPane. Add labels, text fields, and button to the pane as shown
In the figure below.
Set the alignment of the button to the right. [30%]
Process the event. [60%]
Create and register the handler for processing the button-clicking action
event.
The handler must obtain the user input on the loan amount, interest rate, and
number of years. It must then compute the monthly and total payments.
It must display the values in the text fields of the UI.
Ensure modularity [10%]
Create a class called Loan with the following specifications:
3 private instance variables: annualInterestRate (double)
numberOfYears (integer)
loanAmount (double).
At least 1 constructor that would construct a loan object with speififed
Annual interest rate, number of years, and loan amount.
8 methods:
getAnnualInterestRate that returns the annualInterestRate.
setAnnualInterestRate that sets a new annualInterestRate.
getNumberOfYears that returns the numberOfYears.
setNumberOfYears that sets a new numberOfYears.
getLoanAmount that returns the loanAmount.
setLoanAmount that sets a new loanAmount.
getMonthlyPayament that calculates the monthlyPayment and return the
calculated amount. To calculate the monthlyPayment use the
following:
monthlyInterestRate = annualInterestRate / 1200
monthlyPayment = loanAmount * monthlyInterestRate / (1 (1 /Math.pow(1 + monthlyInterestRate, numberOfyears * 12)))
totalPayment = montlyPayment * numberOfYears * 12
Create another class named LoanCalculator that extends application with the specifications
that follows:
Creation of all the controls (nodes): all the text fields, labels and the button
as required by the UI shown.
The start method that overrides the start in the Application class. This
method must create the GridPane object and place the nodes in the
appropriate positions the GridPane object. It should do the routine for
displaying the primaryStage. It should also register the calculatePayment
method to the button control.
1 method named calculateLoanPayment that reads the interestRate,
loanAmount, numberOfYears and parse them to numbers
(doubles and integer)
Creates loan object with interstRate, numberOfYears, and loanAmount.
Displays monthly payment and total payment.
The main method that launches the Application.
figure:
b. Create another class named LoanCalculator that extends application with the specifications that follows: Creation of all the controls (nodes): all the text fields, labels and the button as required by the UI shown. The start method that overrides the start in the Application class. This method must create the GridPane object and place the nodes in the appropriate positions the GridPane object. It should do the routine for displaying the primaryStage. It should also register the calculatePayment method to the button control. 1 method named calculateLoanPayment that reads the interestRate, loanAmount, numberOfYears and parse them to numbers (doubles and integer) Creates loan object with interstRate, numberOfYears, and loanAmount. Displays monthly payment and total payment. The main method that launches the Application. D JavaFx Loan Calc. Annual Interest Rate: 3.5 Number of Years: Loan Amoount: Monthly Payment: Total Payment: CalculateStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
