PROG191_Java Programming_Assignment, Assignments of Java Programming

This Course is for aspiring learners with some programming experience in at least one other programming language who want to be able to solve more complex problems through objected-oriented design with Java. In addition to learning Java, you will gain experience with Java development environments, learn how to program with graphical user interfaces, and learn how to design programs capable of managing data. These software engineering skills are broadly applicable across wide array of industries.

Typology: Assignments

2021/2022

Available from 06/01/2023

TuanAnhMai
TuanAnhMai 🇬🇧

5

(3)

24 documents

1 / 57

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Submission date
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Mai Tran Tuan Anh
Student ID
GCD201452
Class
GCD0904
Assessor name
Pham Thanh Son
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Tuan Anh
Grading grid
Grade (0-10)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39

Partial preview of the text

Download PROG191_Java Programming_Assignment and more Assignments Java Programming in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Mai Tran Tuan Anh Student ID GCD

Class GCD0904 Assessor name Pham Thanh Son

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that

making a false declaration is a form of malpractice.

Student’s signature Tuan Anh

Grading grid

Grade (0-10)

Summative Feedback:Resubmission Feedback:

Grade: Assessor Signature: Date:

Contents

  • I. BUSINESS PROBLEM
      1. Scenario..................................................................................................................................................................................................................
      1. User requirements
      1. UI design.................................................................................................................................................................................................................
  • II. IMPLEMENTATION
      1. Programming language and IDE
      1. Program structure
      1. Model
      1. View
      1. Controller
      • A. LoginController
      • B. MenuController
      • C. IntructionController
      1. Main
  • III. HANDLE EXCEPTION
  • IV. TEST PLAN
  • V. EXECUTING PROGRAM
  • Figure 1: Login screen
  • Figure 2: Main screen.....................................................................................................................................................................................................
  • Figure 3: Instruction screen
  • Figure 4: JavaFX............................................................................................................................................................................................................
  • Figure 5: Scene builder user interface
  • Figure 6: InteliJ user interface......................................................................................................................................................................................
  • Figure 7: Application flowchart
  • Figure 8: Book model (1)
  • Figure 9: Book model (2)
  • Figure 10: Creating fxml file using scene builder
  • Figure 11: Inside a fxml file (Login screen)...................................................................................................................................................................
  • Figure 12: Fxml files in the project
  • Figure 13: Login Controller...........................................................................................................................................................................................
  • Figure 14: File data.txt
  • Figure 15: Function read data from file
  • Figure 16: Function initialize (1)...................................................................................................................................................................................
  • Figure 18: Edit function (1) Figure 17: Function initialize (2)....................................................................................................................................... Error! Bookmark not defined.
  • Figure 19: Edit function (2)
  • Figure 20: Add book function
  • Figure 21: Delete function
  • Figure 22: Instruction Controller..................................................................................................................................................................................
  • Figure 23: Main
  • Figure 24: Example of handling an exception
  • Figure 25: Login screen
  • Figure 26: Main screen.................................................................................................................................................................................................
  • Figure 27: Instruction screen

table to display all the book’s information as well as all the action required from the manger. Last thing is the instruction

screen, where new user can have the guide of how to use the app effectively.

Figure 1 : Login screen

Figure 2 : Main screen

  • Oracle's JavaFX is a software development platform for creating desktop and rich internet applications (RIAs) that may be

viewed on a range of devices. JavaFX Script and JavaFX Mobile are two components of the platform, which was created by Sun

Microsystems.

  • The scripting language is designed to make it easy to utilize the Java Swing user interface toolkit to construct sophisticated

user interfaces that run on any platform that supports the Java standard edition. JavaFX allows the creation of graphical user

interfaces (GUIs) in a declarative language format that defines interface components from Java's Swing interface toolkit, as

well as a variety of display effects such as animation, vector graphics, audio tracks, and video, all of which run in a Java virtual

machine (JVM)

Figure 4 : JavaFX

  • Scene Builder is a tool that allows you to drag and drop JavaFX UI components and then tell your JavaFX program to display

the user interface using the fxml file(s).

Figure 5 : Scene builder user interface

2. Program structure

  • This is the flowchart of the application. At first the user will have to enter correctly their given account, including username

and password. After successfully login into the system, a new screen will appear with the table containing all the book’s

information. At this screen, the manager can choose actions to perform to these data, including read, create, edit and delete.

There’s also instruction for new user

Figure 7 : Application flowchart

3. Model

  • With this application, I decided to work with MVC patterns, including a Model, View and Controller. First, I created a model –

a book class which contain all the properties of a book, including id, name, genre, author and quantity. I set private access

modifier in order to secure the data. I also declare function ToString, which return information of the book

Figure 8 : Book model (1) Figure 9 : Book model ( 2 )

Figure 11 : Inside a fxml file (Login screen)

  • There are 3 files fxml in total. Remember that if developer want to use any resource from the Internet such as picture or

video, they would have to save it with the fxml file in order to appear them successfully

Figure 12 : Fxml files in the project

B. MenuController

  • This is the Controller that mostly handle the flow of the system. First, I created a file that contain all the library book’s

information and put it in a file called data.txt

Figure 14 : File data.txt

  • First, I declare an observableList, which will be the array that contain all the book information. Then I declare a function to

read all the data from this file and load it into a list using FileReader and BufferedReader. As you can see inside the data file,

each component of a book is separate with a “;”. I do this so that when I read the data from this file, I can separate each

component by splitting the “;” symbol and then add into the list. All of this will be put inside a try catch. This will prevent the

system from crashing when there is an error occurs during the executing process.

Figure 15 : Function read data from file