Loan Calculator Application Design and Implementation

Verified

Added on  2025/09/04

|11
|695
|269
AI Summary
Desklib provides solved assignments and past papers to help students succeed.
Document Page
Table of Contents
Design........................................................................................................................................2
Coding........................................................................................................................................3
Output.........................................................................................................................................7
Self-Evaluation...........................................................................................................................7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Design
The application is created to interact with the user. The user interface of this
application is created which allow the user to calculate the monthly and finally
amount for the amount entered in the text field. This interface include the text
field, text area, scroll and labels in the application.
Document Page
Coding
// imported to create the button in the window application.
import javafx.scene.control.Button;
// imported to creatre the border pane in the appplication window.
import javafx.scene.layout.BorderPane;
//imported in order to intilaize the screen in the window application
import javafx.scene.Scene;
// imported to create the textarea componenet in the application window.
import javafx.scene.control.TextArea;
//interface of the program intalizer
import javafx.application.Application;
// imported to created the labels in the window application.
import javafx.scene.control.Label;
// imported in order to create the = stage in the application window.
import javafx.stage.Stage;
// imported to create the textfields in the application window.
import javafx.scene.control.TextField;
// imported to create the scroll component
import javafx.scene.control.ScrollPane;
// imported to create the horizontal box in the application wondow.
import javafx.scene.layout.HBox;
//imported to manage the position of the window application components.
import javafx.geometry.Pos;
// the loanscomparing class is created to create the application
public class loanscomparing extends Application {
// created and intialize the textfield for the value of loan application
TextField loan_value = new TextField();
// created and intialize the textfield for the value of years application
Document Page
TextField year_value = new TextField();
// created and intialize the textfield for the space of loan application
TextArea value_of_space = new TextArea();
@Override
// methods created for first stage intialization
public void start(Stage satgefirst) {
// define the value of the column count.
year_value.setPrefColumnCount(2);
// define the value of the column count for the loan_value.
loan_value.setPrefColumnCount(7);
// define the value of the column count for the space.
value_of_space.setPrefColumnCount(30);
// button is genearted by creating the object of the Button.
Button btn= new Button("Calculate");
// horizontal box is created by creating the object.
HBox ctrl = new HBox();
// set the alignmnet
ctrl.setAlignment(Pos.CENTER);
//set the space
ctrl.setSpacing(9);
// defining the labels for the application window.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
ctrl.getChildren().addAll(new Label("Loan Amount"), loan_value, new Label("Number
of Years"),year_value, btn);
ScrollPane scrlpane;
// the scroll pane object is created.
scrlpane = new ScrollPane(value_of_space);
// the object is created for the Border pane.
BorderPane brdrpn= new BorderPane();
//set brdpn
brdrpn.setTop(ctrl);
// to set the values in the centre
brdrpn.setCenter(value_of_space);
// action of button defined
btn.setOnAction(b -> {
represent();
});
// object is created for the Scene.
Scene tn = new Scene(brdrpn);
// the scen is set
satgefirst.setScene(tn);
// title of the window application is set.
satgefirst.setTitle("Comparing Loans");
// print the stage initial
satgefirst.show();
}
// define the represent method.
private void represent(){
// local variable
Document Page
String finrslt;
// Result intialized
finrslt = "";
// local variables are created for double data type.
double monthinterest;
double paymnth;
// print the columns name
finrslt+="Interest Rate Monthly Payment Total Payment \n";
// loop is created to calculate the interest.
for (double j = 5.0; j <= 8; j += 0.125){
// monthinterest calculation
monthinterest=j/1200;
// calculation of the payment.
paymnth=Double.parseDouble(loan_value.getText())*monthinterest/(1-1/
Math.pow(1+monthinterest, Double.parseDouble(year_value.getText())*12));
// final result calculated.
finrslt+=String.format("%-34.3f%-30.2f%-8.3f\n",j, paymnth,
(paymnth*12)*Double.parseDouble(year_value.getText()));
}
// represent the result
value_of_space.setText(finrslt);
}
public static void main(String[] args) {
launch(args);
}
}
Document Page
Output
Figure 1 Output
Self-Evaluation
Is the UI created correctly?
The user interface successfully created to implement all the functionalities which are required
in this application. Any user can successfully interact with the user and calculate the monthly
and final amount based on the entered amount and year values.
Figure 2 self-evaluation 1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Figure 3 self-evaluation 2
Are the values computed correctly?
The monthly and final payment is successfully calculated by the application based on the
entered amount and the number of years. The value is calculated by the interest rate defining
in the application.
Figure 4 self-evaluation 3
Document Page
Figure 5 self-evaluation 4
Is the table displayed correctly?
The calculated values are properly aligned in the tables. The table contains three columns
interest rate, monthly payment, and the total payment. The values are mentioned in the tables
contain which are associated to each other.
Figure 6 self-evaluation 5
Document Page
Figure 7 self-evaluation 6
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]