MITS4002 Object-Oriented Software Development Activity 9

Verified

Added on  2025/09/04

|9
|383
|150
AI Summary
Desklib provides solved assignments and past papers for students.
Document Page
MITS4002 OBJECT-ORIENTED
SOFTWARE DEVELOPMENT -
ACTIVITY 9
Student ID:
Student Name:
Total Points (20 pts):
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
Table of Contents
Design..............................................................................................................................................2
Code.................................................................................................................................................3
Output..............................................................................................................................................6
Self-Evaluation................................................................................................................................7
UI is correct or not?.....................................................................................................................7
Is the calculation correct?............................................................................................................7
The table is displayed correctly or not?.......................................................................................8
1
Document Page
Design
The criteria of design was developed using the Balsamiq tool. Various elements in the Balsamiq
tool are used for creating the main interface of the Java GUI application. The design is listed
below.
Figure 1 Design
2
Document Page
Code
/*Importing classes and functions from javafx library*/
import javafx.stage.Stage;import javafx.application.Application;
import javafx.scene.layout.HBox;import javafx.geometry.Pos;
import javafx.scene.layout.BorderPane;import javafx.scene.Scene;
import javafx.scene.control.TextField;import javafx.scene.control.Button;
import javafx.scene.control.TextArea;import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
/*End of import files*/
public class knowyourloan extends Application {
/*Decleration of instances*/
TextField loanof_user = new TextField();
TextArea obj_txt = new TextArea();
TextField loanperiod_ofuser = new TextField();
/*Function overriding in Java*/@Override
public void start(Stage showit) {
loanperiod_ofuser.setPrefColumnCount(3);
loanof_user.setPrefColumnCount(8);
obj_txt.setPrefColumnCount(41);
Button inst_but = new Button("Show Table");
HBox bx_obj = new HBox();
bx_obj.setAlignment(Pos.CENTER);
3
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
bx_obj.setSpacing(10);
bx_obj.getChildren().addAll(new Label("Loan Amount"), loanof_user, new Label("Number
of Years"), loanperiod_ofuser, inst_but);
ScrollPane sc_inst;
sc_inst = new ScrollPane(obj_txt);
BorderPane borderobj = new BorderPane();
borderobj.setTop(bx_obj);
borderobj.setCenter(obj_txt);
inst_but.setOnAction(zx -> { showpanel(); });
Scene ceneobjt = new Scene(borderobj);
showit.setScene(ceneobjt);
showit.setTitle("KNOW YOUR LOAN");
showit.show();
}
/*Method for showing the panel and processing calculations*/
private void showpanel(){
String sampleobj="";
double monthlyrate_user,monthlypay_user;
/*Interface of the output*/
sampleobj+="Interest Rate\t\t\t\t\tMonthly Payment\t\t\t\t Total Payment \n";
/*for statement is used for calculations*/for (double
rate_bank=5.00;rate_bank<=8.00;rate_bank+=0.125){
monthlyrate_user=rate_bank/1200;
4
Document Page
monthlypay_user=Double.parseDouble(loanof_user.getText())*monthlyrate_user/(1-1/
Math.pow(1+monthlyrate_user, Double.parseDouble(loanperiod_ofuser.getText())*12));
sampleobj+=String.format("%-58.3f%-58.2f%-7.2f\n",rate_bank, monthlypay_user,
(monthlypay_user*12)*Double.parseDouble(loanperiod_ofuser.getText()));
}
obj_txt.setText(sampleobj);
}
/*Main method*/public static void main(String[] args) {
launch(args);
}
}
5
Document Page
Output
Figure 2 Output
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
Self-Evaluation
UI is correct or not?
The user interface is created using the design criteria made using the Balsamiq tool. The figure
below is the evidence.
Figure 3 Sample Output 1
Is the calculation correct?
Yes, it is correctly done. The per month payment and the closing payment calculated with the
interest rate. The application running properly which is seen below table:
Figure 4 Sample Output 2
7
Document Page
The table is displayed correctly or not?
The elements in the table is done accurately. The table is displayed accurately as seen in the
evidence below. The evidence of the correct displaying of the table is mentioned below.
Figure 5 Sample Output 3
Figure 6 Sample Output 4
8
chevron_up_icon
1 out of 9
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]