(a) Project Structure and Description
Description
Structural features
Figure 1: Game package’s classes in IntelliJ
Game package has 10 classes. This mainly targets the
first success criteria of my client, engaging and
teaching students.
Figure 2: Database Tables and Stored Procedures
These tables were created in SQL Server to work with
the Java program and perform back-end operations
(DDL and DML) with the data entered. These 13 tables
in the FBG database interact with each other to meet
the success criterion. 9 stored procedures are created in
SQL server, allowing better efficiency than ad-hoc
queries in storing data because stored procedures are
precompiled and stored in a runnable form.
Figure 3: Student database structure The ‘student’ table’s design is shown. It consists of
field identifiers, their respective data types, and
variable sizes. “Allow nulls” ensure new records aren’t
created in empty fields.
The auto-incremented primary key ‘studentID’ ensures
each record contains a unique record. In FBG,
‘StudentID’ is a foreign key in the
‘studentPerformanceDetails’ table, allowing attribute
allocation to students using ‘StudentID’.
Figure 5: Packages and classes IntelliJ database connections
Flow of requests’s path:
Request: HTML Template->Login Screen->Controller
(userController)->Service(userService)->Repo
(userRepo)->SQL Server (loginInfo SP).
Requests are created when user initially interacts with
the HTML template, allowing the repository send
queries to SQL server, outputting data.
All components bind data using accessor and mutator
methods, allowing frequent data modification.
Figure 6: Use of CSS, JS and HTML in IntelliJ 17 HTML, 12 CSS and 6 JS files were created. HTML
provides the UI like login and menus while CSS and JS
provide technical details like bootstrap and ionicons.
1
2
Figures 6, 7 and 8: Main GUI Components
Java Swing, IntelliJ’s GUI builder, provides cross-platform compatibility because it effectively runs
with any JVM. Its components are shown in these figures:
3
GUI Components Function
JOptionPane A dialog box that identifies if the user wants to exit the application.
WindowListener It deals with window events, such as the closing of a window.
GamePanel Subclass of JPanel that handles the gameplay rendering and UI updates.
JFrame Window that holds other components and handles the game’s visibility.
KeyListener Manages keyboard actions in real-time, allowing users to move the bird.
JLabel Shows questions to students while being uneditable.
JRadioButton Allows students to only select 1 option from 5 when only 1 option is correct.
JButton A clickable feature that produces an action like ensuring if the clicked button is the
right answer.
ButtonGroup Combines radio buttons to produce the options for questions.
(c) OOP Techniques
OOP framework helps maintain the coding standards and promotes reusability. Below are some
examples:
Figure 8: Constructor and initialisation of instance variables
4
This constructor initialises a Bird object with default size, position, and state values. It’s suitable because it immediately
initialises every Bird parameter, which is vital for correct functionality and gamification (success criteria 1)
Figure 9: Inheritance and Encapsulation
Inheritance: GamePanel inheriting from JPanel allows it to function as a Swing component. This permits GamePanel to
perform rendering functionalities, managing user input and layout.
5
Encapsulation: The game instance represents the game state and has a private access modifier, preventing any
outsiders’ modification.
Figure 16: Accessor and Mutator Methods in SessionManager class.
Manages various properties within the application to improve student engagement when learning (success criteria 1) by
allowing other classes to obtain values without accessing variables, preventing unwanted changes, and allowing other
classes to update values when necessary.
(d) Other Complex Java Techniques
Complex techniques Purpose within code
Stores the bird’s x-y coordinates throughout the
game to easily render the game. Updating bird
positions in an array allows easy collision
Figure 11: Dynamic 2D array initialisation of bird positions detection.
Figure 12: Implementing a hierarchical composite data structure (Arraylist) As suggested by the tutor to increase application
engagement, this ArrayList stores all renderable
objects including Bird, Pipes, and the
background images for the game. This permits
the getRenders class to draw every required
element from a single location, improving
flexibility.
6
2 score arrays are being combined into 1 sorted
array, allowing the teachers to view students’
scores more easily and identify each students’
status in learning.
The specific screen for this is seen below:
Figure 13. Merging sorted data structures
Figure 14. Teachers viewing any student’s performance.
This submenu contains a drop-down list,
allowing teachers to check any student’s
performance.
Tutor’s success criteria 13 is met as a text file is
read and returned on the webpage. The file
contains instructions on playing the game and
hardcoding is prevented. BufferedReader is
necessary because it manages I/O
functionalities, which throw exceptions,
requiring try-catch.
Figure 15: Parsing a text file with exception handling
This is specifically seen below:
Figure 16. Game instructions, located in the “start game” submenu.
7
Hashmap performs caching to store the game’s
images loaded from the CDrive. This is done by
Figure 17: Use of a Hashmap in Util class mapping every image’s file path to its respective
‘Image’ object, aiding gamification by providing
graphics for game.
8
9
Figures 18, 19, 20, and 21: high score modification by adding, deleting, and searching in random access files.
RandomAccessFile is used to store and modify high scores in binary. Achieved by creating a temporary file,
making modification easier, and preventing data loss.
Figure 22: MD5 encryption implementation
This improves application security by reducing the probability of unauthorised users from identifying the
password of each user, providing personalised experiences for all users. The code takes input and produces its
MD5 hash, used for encrypting the password. This aligns with success criteria 7 because encryption is provided to
passwords in login history system. The submenu is shown below:
10
Figure 23: Login History submenu, encrypted password seen in the ‘password’ column.
(e) Database Connections
Spring provides dependencies of this class. The
@GetMapping decorator automatically after
creating an instance receives userID from the
SessionManager. It calls ‘bindAchievements’
method from the ‘studentService’ class, allowing
interaction with database. This supports the
storing of student incentives, aligning with
Figure 24: Dependency injection via @Autowired decorator and success criteria 4. Below shows the achievements
GetMapping decorator submenu:
Figure 25: Achievements submenu that stores the number of
trophies and certificates for a sample student.
11
‘getStudentByUserId’ method differentiates each
student by their ID, helping to achieve client’s
success criterion. Students can see their own
performance due to their unique ID and use their
ID to login to only their account.
‘bindAchievements’ method provides a specific
achievements list for each student based on a
unique ID, correlating with success criteria
regarding incentive provision.
Figure 26: StudentRepo interface.
12
Figure 27 and 28: StudentService with complex if-else statements inside for loops.
From ‘StudentRepo’ interface, a student’s list is received by ‘bindStudentList’ method, calling stored
procedures, aligning with success criteria that allow for different menus for students and teachers.
‘getStudentByUserId’ receives specific student’s profile details using a unique StudentID by calling stored
procedures through the repository, aligning with success criteria that helps change password and other login
features. Below are the main menus for both users:
Figure 29: Student main menu screen. This is shown from a sample student.
13
Figure 30: Teacher main menu screen. This is shown from a sample teacher.
(f) Styling Conventions
Cornell University’s Java Guidelines are used to identify the appropriate styling conventions. All code snippets shown are
written in CamelCase, and “_” isn’t used. Variable names begin with a lowercase letter. This convention followed
“Substatements of a statement or declaration should be indented”(Gries, 2017). Comments are used appropriately to identify
the function of each technique in the code without over-commenting.
(g) AWT (Abstract Window Toolkit) Libraries
WindowAdapter
WindowEvent
ActionEvent
ActionListener
KeyEvent
Image
AffineTransform
Toolkit
awt.*
(h) Java Input/Output Libraries
IOException
RandomAccessFile
File
ImageIO
FileLock
io.*
(i) Java Foundation Classes
Javax.swing.*
(j) Jakarta Enterprise Edition Libraries
jakarta.persistence.*
14
Valid
Email
NotEmpty
Pattern
Size
Entity
Id
Table
(k) Java Standard Libraries
ArrayList
Hashmap
Arrays
List
java.awt*
Date
Duration
Objects
(l) Lombok Libraries
AllArgsConstructor
Data
ToString
JpaRepository
Repository
Procedure
Param
(m) Spring Framework Libraries
Autowired
Controller
HttpSession
Model
BindingResult
Bind.annotation.*
RestTemplate
RedirectAttributes
stereotype.Component
GetMapping
PostMapping
Service
Transactional
SpringApplication
SpringBootApplication
ApplicationContext
ComponentScan
Configuration
EnableJpaRepositories
EnableTransactionManagement
(n) Security Libraries
MessageDigest
NoSuchAlgorithmException
15
(o) Login and Sign In Pages with Code
Figure 31: Annotated login page with its major components
Figure 32: Button hovering changes
Figure 33: Giving specific colors, sizes, and text fonts to the buttons
Figure 34: Adding space between form groups, and changing label and input styles
16
Figure 35: Annotated HTML code to demonstrate validations.
Figure 36: Annotated Java code with series of if statements to store user IP address and redirect users to their respective menu.
Figure 37: Stored Procedure to provide commands that help store the login details for each user.
17
Figure 38: Annotated Sign-Up page.
Figure 39: Annotated Java code to validate user sign-up details and redirect users to their respective menus.
18
Figure 40: Annotated JS code that ensures complex validations by using length, presence, and format checks.
(p) Exiting the application
Figure 41: Annotated JS code that ensures complex validations by using length, presence, and format checks.
Figure 42: Use of Java Swing components to create this window
19
(p) Student Play Game submenu
Figure 43: Student Play Game submenu.
20
(q) UML Diagram
Figure 44: UML diagram showing the main functionalities of the product
Word Count: 1031 words
Work Cited
Gries, D. (2017). cs.cornell. Java Code Style Guidelines. Retrieved August 29, 2024, from
https://www.cs.cornell.edu/courses/JavaAndDS/ JavaStyle.html#CamelCase
w3schools. (n.d.). SQL Tutorial. w3schools.
https://www.w3schools.com/sql/
Microsoft. (2024, September 16). Tutorials for SQL Server. learn.microsoft.
21
https://learn.microsoft.com/en-us/sql/sql-server/tutorials-for-sql-server-2016?view=sql-serv
er-ver16
Oracle. (n.d.). Trail: Creating a GUI With Swing. docs.oracle.
https://docs.oracle.com/javase/tutorial/uiswing/index.html
w3schools. (n.d.). Java ArrayList. w3schools.
https://www.w3schools.com/java/java_arraylist.asp
geeksforgeeks. (2024, October 4). HashMap in Java. geeksforgeeks.
https://www.geeksforgeeks.org/java-util-hashmap-in-java-with-examples/
Microsoft. (2024, January 31). Create a stored procedure. learn.microsoft.
https://learn.microsoft.com/en-us/sql/relational-databases/stored-procedures/create-a-stor
ed-procedure?view=sql-server-ver16
Free Learning Platform for Better Future. (n.d.). Spring Tutorial. javatpoint.
https://javatpoint.com/spring-tutorial
eclipse. (2021, December). The Jakarta® EE Tutorial. Eclipse.
https://eclipse-ee4j.github.io/jakartaee-tutorial/
geeksforgeeks. (2022, August 30). MD5 hash in Java. geeksforgeeks.
https://www.geeksforgeeks.org/md5-hash-in-java/
w3schools. (n.d.). Java Exceptions - Try...Catch. w3schools.
https://www.w3schools.com/java/java_try_catch.asp
geeksforgeeks. (2019, May 23). Java.io.RandomAccessFile Class Method | Set 1.
geeksforgeeks.
https://www.geeksforgeeks.org/java-io-randomaccessfile-class-method-set-1/
Kumar, P. (2024, October 4). Different ways of Reading a text file in Java. geeksforgeeks.
https://www.geeksforgeeks.org/different-ways-reading-text-file-java/
Stratofortress. (n.d.). Java Game Programming Tutorial - Flappy Bird Redux.instructables.
https://www.instructables.com/Java-Game-Programming-Tutorial-Flappy-Bird-Redux/
Jeong, S. (2022, May 12). Implement Password change in SpringBoot using JPA. medium.
22
https://medium.com/@seonggil/implement-password-change-in-springboot-using-jpa-fbc46
f037ac3
geeksforgeeks. (2024, May 23). Implementing Edit Profile Data Functionality in
Social Media Android App. geeksforgeeks.
https://www.geeksforgeeks.org/implementing-edit-profile-data-functionality-in-social-media-
android-app/
PragmaticCoding. (2024, June 20). Tracking Task Progress. pragmaticcoding.
https://www.pragmaticcoding.ca/javafx/elements/task-progress
Delgado, J. (n.d.). [Green land background with sky hd cartoon].openart.
https://openart.ai/community/VAhDFl5YmWvMusFoLumQ
23