0% found this document useful (0 votes)
28 views

Criterion C: Techniques Used in The Programme

This document describes the key techniques used in a student and teacher education program. It heavily relies on object-oriented programming principles like inheritance, classes, polymorphism and functions. The program uses inheritance to determine user types and provide different interfaces. It also utilizes SQL databases, Java Swing elements, email libraries, constructor overloading, nested if/else statements, loops and dynamic searching to store and retrieve user data, send messages and error check information. Classes, helper classes and large functions are implemented to organize code and simplify the programming process.

Uploaded by

Sarvagya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Criterion C: Techniques Used in The Programme

This document describes the key techniques used in a student and teacher education program. It heavily relies on object-oriented programming principles like inheritance, classes, polymorphism and functions. The program uses inheritance to determine user types and provide different interfaces. It also utilizes SQL databases, Java Swing elements, email libraries, constructor overloading, nested if/else statements, loops and dynamic searching to store and retrieve user data, send messages and error check information. Classes, helper classes and large functions are implemented to organize code and simplify the programming process.

Uploaded by

Sarvagya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Criterion C

Techniques Used in the Programme:

1. Object Oriented Programming

- Inheritance

- Functions

- Classes

- Polymorphism

______________________________________________________________________________

This programme is heavily dependent on inheritance.

When code is executed, there is an appropriate constructor in the child class.

The use of inheritance begins after the user logs in:


It compares the username to the database, thus determining the type of user. The user is

either a “student” or “teacher” (stored in the database). The users have different main interfaces;

it is important to transfer the username.

- The following is the student interface:


- The following is a “Teacher” interface.
Beforehand, users must have an account. This is done in Register.java.
Register.java transfers important user information. The inheritance helps with security and

data validity; Register.java uses a nested “if” function (explained on page …) for error handling.

Once completed, it generates a random 6-digit code, which is inherited by the child class

(Confirm.java) and sent via email.


The user is registered only when the appropriate 6-digit code is entered.

Lengthy Functions are used for multiple purposes throughout the programme. They are

used to shorten programming time and the size of the programme. This register function can be

triggered by the JButton and 5 JTextFields:


There are a plethora of tables, in constant need of updating:
Classes are extensively used: large number of screen layouts making the programme more

versatile. Here is a complete list of classes used:


For the programme to accurately manipulate the large number of database tables, helper

classes are used.


This class allows the teacher to specify which set of questions to send to the students. This

additional information pinpoints which database table to manipulate.

Another helper class is ChooseSentQuestions.java:


It displays the subject a student received a question set from (first JComboBox), and the

name of the set (second JComboBox). This information is inherited by the AnswerQuestions.java

class, where the student completes work.

The term appearing in JTextField is retrieved from the database:


It cross-checks the database for Questions and Answers with the same NameOfSet and

Subject. The global integer numberOfQuestions increases each time ResultSet returns true for

next(). It then initialises two global String arrays: Terms are inserted into one array, and the

definitions at the other (at the same indexes).

The JTextField is populated with arrayQuestions at an index=0. It increases with every

correct answer, which is compared to arrayAnswers.

Upon full completion, the students name is inserted into the database: the teacher can view

completion of assigned tasks.

Polymorphism is used in creating a dynamic clock (user-friendly feature). The clocks can

be seen on the main “Teacher” and “Student” interfaces (Pages 3 and 4)


2. Java Swing Package

It provides an interactive input/output interface for the user. The following are specific java

swing elements used in the programme.


A. JLabels - Screen titles and functional links to other classes which allow the user to recover

their account (“Forgot your password?”), and reveal answers to questions.

B. JTextFields - Mainly for data entry and displaying information to users. Most text fields

also have actionPerformed functions.

C. JButton - Carrying out functions, described by the code inscribed in them.

D. JTable - Displaying data and allowing users to select information from the table for editing

or for having further interaction with.


E. JComboBox - Selecting a piece of data, for a more specific search or access to particular

databases.

F. JTextArea - Larger text representation.

G. JPasswordField - Storing passwords in a more secure manner.

H. JOptionPane - Error-handling and confirming choices by users, which, if made, could lead

to the loss of data.

I. JMenu - Adds functionality to the main user interface.

3. Libraries

Imported libraries are used to provide email services. This allows for extra security during

registration: the programme sends a 6-digit code to the user, in order to confirm data validity upon

registration.
The teachers can send emails to their students directly. Once studentList.java class is

opened, the teachers can view their current students.


It retrieves the user’s email from the database, via their username. This is a friendly-user

feature, which is what the client desired, as pointed out in the interview (Appendix 1).

4. Database Connectivity

The programme uses an SQL database.

This code shows types of functions utilised in the programme for database manipulation.

A. Retrieving Data
It gathers data from a specific database table. It uses PreparedStatement and ResultSet.

B. Updating Data

This function replaces the original data in the Database, with new Strings, input through

the JTextFIelds.
C. Deleting Data

This function searches for the desired data in the Database and permanently removes it.

Considering there are a number of database tables, the PreparedStatement uses the String “receive”

to specify from which table the data should be removed; it contains the name of the teacher and

the name of the subject, which is how the tables are named when first created by the “teacher”

users.

D. Adding Data
When the teachers or students create new study sets, a new class is created, a student joins

a class, or a student finishes work, data is inserted into the database.

E. Creating new Database Tables

Lastly, this function is used to create new tables in the database. It allows for the same

teacher to teach more than one subject. Statement creates a table with three distinct Columns: the

name of the set, the term, and the definition.


5. Constructor Overloading

Certain classes display different GUI and functions, based on the data inherited from

previous classes. In this example, depending on the type of data inherited, the GUI would display

different elements.

6. Nested “if” statements

This is mainly used to allow error-handling while the user is entering data. There is an

abundance of data in need of cross-checking before being stored in the database.


This function collects the data from JTextFields and JComboBox. It then starts checking

whether all data is entered; nothing should be unedited. Lastly, the email and the username are

cross-checked with the database of users. Users cannot have identical emails or usernames.

7. Nested Loops

Mostly used with Arrays. The following code removes repeating items from the

JComboBox. At first, all of the items are stored in an array. The nested loops, combined with the

“if” function store only one copy of the items from the original array.

8. Dynamic Searching

It allows users to search for the desired data from a table. When a key is pressed,

getSelectedRow() is used. Vectors clone the original table, which is compared to the characters

used in the search bar (JTextField). The elements not containing a desired search combination (in

both of the columns) are removed.


Words: 1038

References:

- Dimitriou, Kostas, and Markos Hatzitaskos. Advanced Computer Science: for the IB
Diploma Program (International Baccalaureate) High Level Computer Science. Express
Publishing, 2018.

- Dimitriou, Kostas, and Markos Hatzitaskos. Core Computer Science: for the IB Diploma
Program (International Baccalaureate). Express Publishing, 2018.

- General Syntax Referencing: StackOverflow. Retrieved from: https://stackoverflow.com

- Liang, Y. Daniel. Introduction to Java Programming: Brief Version. Pearson Education


Limited, 2019.

You might also like