Etss PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 98

EXAMINATION TIMETABLE SCHEDULING SYSTEM

(ETSS)

by

OROKE KENNETH AUGUSTINE


CS/11/197

Submitted to

THE DEPARTMENT OF COMPUTER SCIENCE


FACULTY OF SCIENCE
MADONNA UNIVERSITY, ELELE CAMPUS

SEPTEMBER, 2015
ACKNOWLEDGEMENT
This work reached the stage it is not because of me alone but for the grace of God has given me to
achieve it, so I thank Him.

Prof. Emmanuel Kamgnia, I am most sincerely grateful for accepting to be my supervisor and for
all your advice and support throughout the course of this project work.

My appreciation also goes to Mrs. Adanma Celia Eberendu-Ogu for her unending support and
advices. I also want to thank my Head of Department, Dr. Timothy Atabong, the entire staffs and
students of Computer Science department for the knowledge they have impacted into me so far.

Finally, my lovely and wonderful family, the family of Mr. & Mrs. Emmanuel Oroke, they have
been really supportive, both morally, financially and spiritually; I must say they are the best. To
Caroline Alexander, Maryann Emengini, Stella Maris Onwuama, Chiwendu, Obuma Olodi
Chiosom, Itobiye Ebenezer, Valentine Chibuzor, Iwuchukwu Franklin, Evelyn Nwibo and all other
friends not mentioned who have helped me in one way or the other since from my 100level.

ii
CERTIFICATION
This is to certify that this project work on “Examination Timetable Scheduling System” by Oroke

Kenneth Augustine has met the conditions for the award of Bachelor of Science (B.Sc.) degree in

the department of Computer Science of Madonna University, Elele Campus.

It is hereby approved for its contribution to knowledge.

Prof. Emmanuel Kamgnia Date


(Supervisor)

Dr. Timothy Atabong Date


(Head of Department)

Dr. Okure U. Obot Date


(External Supervisor)

iii
DEDICATION
This piece of work is dedicated to my Lovely Mum, Mrs. Ngozichukwu Blessing Oroke who has

been best and wonderful mentor and pillar. I love you mum

iv
TABLE OF CONTENTS
TITLE PAGE ................................................................................................................................................. i

ACKNOWLEDGEMENT ........................................................................................................................ ii

CERTIFICATION ..................................................................................................................................... iii

DEDICATION .......................................................................................................................................... iv

TABLE OF CONTENTS ............................................................................................................................ v

LIST OF TABLES ........................................................................................................................................x

LIST OF FIGURES .................................................................................................................................... xi

ABSTRACT ............................................................................................................................................... xii

DECLARATION ..................................................................................................................................... xiii

CHAPTER ONE ......................................................................................................................................... 1

INTRODUCTION .................................................................................................................................... 1

1.1 PROJECT BACKGROUND .......................................................................................................... 1

1.2 PROBLEM STATEMENT .............................................................................................................. 2

1.3 OBJECTIVE OF STUDY ............................................................................................................... 3

1.4 SIGNIFICANCE OF STUDY ........................................................................................................ 3

1.5 SCOPE OF STUDY ........................................................................................................................ 4

1.6 LIMITATIONS OF STUDY .......................................................................................................... 4

v
1.7 ORGANIZATION OF STUDY .................................................................................................... 4

1.8 DEFINITION OF TERMS ............................................................................................................. 5

CHAPTER TWO ....................................................................................................................................... 6

LITERATURE REVIEW ............................................................................................................................ 6

2.1 RELATED WORKS ............................................................................................................................. 6

2.2 WHAT IS TIMETABLING? ............................................................................................................. 8

2.3 CONSTRAINTS ................................................................................................................................... 8

HARD CONSTRAINTS ........................................................................................................................ 9

SOFT CONSTRAINTS .......................................................................................................................... 9

2.4 DIFFERENT HEURISTICS USED TO SOLVE TIMETABLING PROBLEM....................... 10

2.4.1 Simulated Annealing ........................................................................................................... 10

2.4.2 Evolutionary Algorithms .................................................................................................... 10

2.4.3 Tabu Search ............................................................................................................................ 11

2.4.4 Integer Programming.......................................................................................................... 11

2.4.5 Constraint Programming ................................................................................................... 11

2.4.6 GRASP........................................................................................................................................ 11

2.4.7 Tiling Algorithms .................................................................................................................. 12

2.4.8 Hybrid Approaches .............................................................................................................. 12

vi
2.4.9 Comparative Studies ............................................................................................................ 12

CHAPTER THREE ................................................................................................................................... 14

SYSTEM ANALYSIS ............................................................................................................................... 14

3.1 ANALYSIS OF PROPOSED SYSTEM ......................................................................................... 14

3.2 SYSTEM FEASIBILITY ................................................................................................................... 14

OPERATIONAL FEASIBILITY ........................................................................................................ 14

ECONOMIC FEASIBILITY .............................................................................................................. 15

TECHNICAL FEASIBILITY .............................................................................................................. 15

3.3 REQUIREMENT ANALYSIS ......................................................................................................... 15

3.3.1 USER REQUIREMENTS ........................................................................................................ 15

3.3.2 SYSTEM REQUIREMENT SPECIFICATIONS ................................................................. 16

3.3.3 HARDWARE REQUIREMENTS .............................................................................................. 17

3.3.4 SOFTWARE REQUIREMENTS ................................................................................................ 18

CHAPTER FOUR..................................................................................................................................... 20

SYSTEM DESIGN ................................................................................................................................... 20

4.1 DESIGN METHODOLOGY ......................................................................................................... 20

4.2 ALGORITHM OF IMPLEMENTATION.................................................................................... 21

4.3 SYSTEM FLOWCHART................................................................................................................. 21

vii
4.4 INTERFACE DESIGN ..................................................................................................................... 27

4.5 DATAFLOW DIAGRAM .............................................................................................................. 31

4.6 CLASS DIAGRAM........................................................................................................................... 33

CHAPTER FIVE ....................................................................................................................................... 37

SYSTEM IMPLEMENTATION ............................................................................................................. 37

5.1 LANGUAGE OF IMPLEMENTATION ...................................................................................... 37

5.2 DESIGN IMPLEMENTATION ..................................................................................................... 38

5.3 TESTING ............................................................................................................................................ 42

5.3.1 UNIT TESTING ....................................................................................................................... 42

5.3.2 MACHINE TESTING ............................................................................................................. 45

5.4 SYSTEM COUPLING ..................................................................................................................... 46

5.4.1 SOFTWARE INSTALLATION GUIDE .............................................................................. 46

5.4.2 SYSTEM REQUIREMENT .................................................................................................... 46

5.4.3 TROUBLESHOOTING .......................................................................................................... 46

5.4.4 USER MANUAL ...................................................................................................................... 46

CHAPTER SIX ......................................................................................................................................... 47

SUMMARY, CONCLUSION AND RECOMMENDATION .......................................................... 47

6.1 SUMMARY ....................................................................................................................................... 47

viii
6.2 LESSON LEARNT ............................................................................................................................ 47

6.3 FUTURE TRENDS............................................................................................................................ 47

6.4 CONCLUSION ................................................................................................................................ 47

6.5 RECOMMENDATION .................................................................................................................. 48

REFERENCES ........................................................................................................................................... 49

APPENDIX ............................................................................................................................................... 50

ix
LIST OF TABLES
Table 1: Daily Timeslots …….……………………………………………………….. 16

Table 2: Timeslots …………………………………………………………………… 16

Table 3: Economic Feasibility Table ………………………………………………… 30

Table 4: Hardware Requirements …………………………………………………... 34

Table 5: Software Requirements ……………………………………………………. 35

Table 6: Test Plan …………………………………………………………………… 50

Table 7: LoginUI Unit testing ………………………………………………………. 56

Table 8: SchoolUI Unit testing ……………………………………………………... 58

x
LIST OF FIGURES
Figure 1: Event driven control system for ETSS ……………………………………. 20

Figure 2: System Flowchart ………………………………………………………… 22

Figure 3: LoginUI Flowchart ……………………………………………………….. 23

Figure 4: SchoolUI Flowchart ……………………………………………………… 24

Figure 5: HallUI Flowchart ………………………………………………………… 25

Figure 6: CourseUI Flowchart ……………………………………………………… 26

Figure 7: Data Flow Diagram ………………………………………………………. 32

Figure 8: Class diagram for LoginUI ………………………………………………..33

Figure 9: Class diagram for SchoolUI ………………………………………………34

Figure 10: Netbeans IDE ………………………………………………………….... 37

Figure 11: Netbeans IDE coding environment ……………………………………, 38

Figure 12: LoginUI Unit test 1 ……………………………………………………... 42

Figure 13: LoginUI Unit test 2 ……………………………………………………... 43

Figure 14: LoginUI Unit test 3 ……………………………………………………... 43

Figure 15: SchoolUI Unit test 1 …………………………………………………… 44

Figure 16: SchoolUI Unit test 2 …………………………………………………… 45

xi
ABSTRACT
Examination timetable scheduling system (ETSS) is a proposed system that will be used to allocate

examinations to given rooms within a given range of timeslot under some constraints.

Examination Timetabling Problem has no fixed algorithm or technique for solving it as several

heuristics need be combined before a good solution can be gotten. This system is aimed at

eliminating the time and cost accrued when scheduling examinations manually by making sure

a near conflict free timetable is possibly generated at the end this of implementation. This is done

by making sure the hard and soft constraints are all satisfied if not completely till an optimal

solution is gotten. The proposed Examination Timetable Scheduling System will make use of the

constraints to determine the range of values each variable or resources (Courses, Rooms and

Timeslot) can carry and this is implemented in three basic steps which are grouping, time-

slotting and room alocation.

xii
DECLARATION
I Oroke Kenneth Augustine, hereby declare that this project work, “Examination Timetable

Scheduling System (ETSS) has been written by me and it is a record of my research work.

Reference made to publish this work of literature have been duly acknowledged and cited herein.

Oroke Kenneth Augustine Date


(Student)

The above declaration is hereby confirmed by:

Prof. Emmanuel Kamgnia Date


(Supervisor)

xiii
CHAPTER ONE

INTRODUCTION
1.1 PROJECT BACKGROUND
At the end of each Academic Semester, all institutions are faced with the tedious task of setting

up examination timetable for students and this is usually time consuming and stressful owing to

the fact that lots of work are done manually.

Examination timetabling problem is a combinatorial problem that entails allocating a certain

number of examinations within a specific time from obeying some constraints that serve as

limiting factors to the number of value the resources (examinations, timeslots and rooms) can

carry.

Examination Timetable Scheduling System (ETSS) is aimed at making examination scheduling

easier, less time consuming and fun for institutions. Though several methods have been applied

to solving this problem, they range from Ant Colony Optimization, Local Search Technique,

Mimetic Algorithm, Graph Coloring techniques, Meta-heuristic methods, Genetic Algorithm and

many more and everyday new ones comes up.

In solving the Examination Timetable Scheduling System problem, three main techniques were

applied and they are:

Grouping of the courses into groups that can be scheduled together

Time-slotting

Then assigning them to rooms by considering the total number of students for the

group selected in a given timeslot.

1
This system is characterized by a set of student taking a set of examinations over a specified

period of time within the contest of several constraints which are either fully satisfied (Hard

constraints) or partly satisfied (Soft constraints) so as to yield a feasible and optimum solution

respectively. The main setbacks of the Examination Timetable Scheduling System (ETSS) is the

limited number of resources available for use.

As the number of students seating for an examination and the total number of courses to be

scheduled increases, the Examination timetabling problem becomes more complex and more

heuristics needs be combined to get an optimum solution thus making the problem space wider.

1.2 PROBLEM STATEMENT


ETSS is a system that aims at solving the problem with allocation of examinations manually thus

eliminating time spent and stress incurred. As a system, it aims at achieving this with less conflict.

In this paper, we take a case study of Madonna University, Elele Examination System where we

will be have four (4) weeks for examinations with a total number of 15 halls each having a

specified capacity and number of students it can carry. We will also have a total of six (6)

examinations days with Saturday having only two (2) possible timeslots while others will have

three (3) timeslots each and each of that timeslot could probably allow for a minimum of three

(3) and maximum of six (6) examinations daily and two (2) or three (3) rooms depending on the

course level.

The tables below depicts the afore-mentioned and explained details up:

WEEKS MONDAYS TUESDAYS WEDNESDAYS THURSDAYS FRIDAYS SATURDAYS

WEEK 1 1 1 1 222 333 444 555 66

WEEK 2 8 8 8 999 10 10 10 11 11 11 12 12 12 13 13

2
WEEK 3 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20

WEEK 4 22 22 22 23 23 23 24 24 24 25 25 25 26 26 26 27 27

Table 1: Daily Timeslots

WEEKS MONDAYS TUESDAYS WEDNESDAYS THURSDAYS FRIDAYS SATURDAYS

WEEK 1 1 2 3 456 789 10 11 12 13 14 15 16 17

WEEK 2 22 23 24 25 26 27 28 2930 31 32 33 34 35 36 37 38

WEEK 3 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

WEEK 4 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

Table 2: Timeslots
In the tables above, we can see that some numbers (e.g. 18, 19, 20 and 21 in week 1) were omitted

because those days do not normally get scheduled. Those are the cases of Sundays and last

timeslots on Saturdays that have only two timeslots for examinations.

1.3 OBJECTIVE OF STUDY


This study is aimed at eliminating the stress and time spent in developing examination timetable

using the manual method in Madonna University, Elele Campus.

At the end of this research work, a timetable which has little or no conflict is the targeted output.

1.4 SIGNIFICANCE OF STUDY


Examination timetable scheduling system is very vital and important in that it is aimed at making

administrative duty of examination scheduling less difficult and time consuming. It also

guarantees generation of an effective and a low conflict timetable that is to be benefit and

advantage of the staff and students in question.

3
1.5 SCOPE OF STUDY
This project will be designed in such a way to allow for several interfaces (JFRAMES) i.e. LoginUI,

SchoolUI, HallUI, CourseUI and FinalTimetable all of which will allow for data entry by the

administrative user, data retrieval by the normal user and data manipulation by the program.

The study may not be able to generate a completely working timetable but efforts will be made

to make good use of the programming concept of the implementation language.

1.6 LIMITATIONS OF STUDY


During the course of this research work, some setbacks were encountered that brought about

limited implementation of some features of the proposed system. They include:

Limited access to existing system which are fully functional and most of the functional

needed to be bought at high prices.

Lack of highly skilled knowledge of the language of implementation also limited

functionality of the proposed system.

Little hardware issues that halted the research work for some period of time.

1.7 ORGANIZATION OF STUDY


Examination Timetable Scheduling System is divided into several chapters of literature and each

of them handles a section of the project work. Chapter one introduces the entire project to the

intended audience. In chapter two, works related to Examination Timetable Scheduling System

that have been done or works similar to the proposed system and analyze them likewise more

issues about the proposed system is to be discussed here. Chapter three centers on how the ETSS

will be designed to suit easy user accessibility likewise the basic features of the system are covered

here. System Design is covered in chapter four and this has to do with designing a blue-print of

the proposed system such that it will be easy for the programmer to develop the proposed system

4
on looking at it. In chapter five, the design is fully implemented and the system developed for use

by the audience, while chapter six gives a brief summary about the developed system and all the

procedures undergone to develop it in brief forms. It also brings to light the developer’s thoughts

and conclusions.

The reference and appendix follows; reference contains citations and acknowledgement of

sources of data collection while the appendix holds the program’s source codes in printed form.

1.8 DEFINITION OF TERMS


Timetable: This is a placement of a set of meetings or resources in time.
Meeting: This is a combination of resources some of which may be specified by the

problem and some are part of the solution.

Constraint Programming: This is a type of logical programming whereby set of variable are

programmed to carry values which are usually determined by some set of constraints

which can be hard or soft.

Interfaces: These are java frames that represent screens or resources that are used in the

scheduling problem.

Feasible Solution: This is the solution generated when hard constraints are fully satisfied.

Optimum Solution: Optimum solution are those gotten when soft constraints have been

dealt with appropriately.

Timeslot: This is a given time period when a set of examination can hold in a day.

Conflict Matrix: A matrix that holds courses that are clashing and are not scheduled.

5
CHAPTER TWO

LITERATURE REVIEW

2.1 RELATED WORKS


The Examination timetabling problem has received ample attention over the past years and

numerous methods have been applied to solving it. Some of the approaches that have given

satisfactory results are:

Constraint Programming (Citeseer, 1998)

Hybrid-methods (E.K Burke and J.P Newall, 2004)

Hyper-heuristics (Banzhaf and Pillay, 2009)

Various meta-heuristics (Banzhaf and Pillay, 2009) and many more…

The International Timetabling Competition (ITC) 2007 model of the Examination Timetabling

Problem was solved by scatter meta-heuristics and the whole process is undertaken by our

distributed execution framework called SchedScripter and the solution obtained indicates that

significant potentials of using analogous methods to similar problems exists.

An Examination Timetabling Problem can be capacitated or incapacitated (Banzhaf, 2009).

Incapacitated Examination Timetabling Problem has received attention over the past decades

from Artificial Intelligence and Operations Research communities. Earlier developments were

based on Graph Coloring heuristics methods used to assign examinations to timeslots one by one

based on some criteria. A backtracking method is often used with these methods as a recovery

approach to timetable with unscheduled examinations. Incapacitated examination timetabling

problem was initiated by Carter et al when he asked several graph coloring heuristic methods.

6
Local Search based methods are able to explore the search space and find a local optimal solution

more structurally, precisely and faster than population-cased methods. University examination

timetabling problem is concerned with assigning a set of examinations with each taken by a set

of students, to a set of timeslots with respect to hard constraints that needs full attention and soft

constraints to create an optimized solution.

A three phased approach was developed by Muller to solve the problem in the ITC 2007

examination timetabling track. The first phase is the Iterative forward search algorithm to find

a feasible solution followed by Hill climbing to find the local optima and finally the Great deluge

algorithm used to further explore the search space. (PATAT, 2010)

Gorgos et. al proposed a method which used a GRASP (Greedy Randomized Adaptive Search

Procedure). In the construction phase, examinations are ordered based on some criteria which

are been generated. Tournament selection is used to select examinations until they are all

scheduled (if possible) then a back tracking strategy using tabu search list is employed as

required. In the improvement phase, simulated annealing is used. Finally, room allocations are

arranged using Integer programming in phase three (3).

Pilley (PATAT, 2010) introduced a biologically inspired approach that exhibits cell behaviors.

Here, the examinations are initially ordered using the saturation degrees heuristics and

scheduled in the available cells (timeslots). If more than one timeslot is available, the slot which

causes the lowest overall constraint violation is chosen. Rooms are chosen using best fit heuristics

ad if a constraint occurs before all examinations are fully scheduled, the timetable is re-

organized to reduce soft constraints violation (cell division) likewise timeslots can be swapped to

remove hard constraint violation and improve soft constraints. The process continues until a

7
feasible solution is achieved then cell migration is done i.e. swapping contents of cells with same

durations to improve solution.

In (E.K Burke and J.P Newall, 2004) as an iterated construction algorithm is described. They make

use of a construction ordering heuristic as the basic method for scheduling the examinations. On

the other hand, the experiment scheme increments the degree by 2n, where n is the number of

iterations by which a given degree was modified. Moreover, the algorithm’s performance was

compared when using different basic ordering heuristics.

2.2 WHAT IS TIMETABLING?


Timetabling is the process of allocating resources subject to some constraints being placed in a

space time such that the constraints need be settled.

Timetabling is the allocation subject to constraints of given resources to objects placed in

timeslots, in such a way as to satisfy as nearly as possible a set of desired objectives. (Citeseer,

1998).

In order to make this possible, we need know if the resources available will be sufficient for the

allocation to be done in the time given. The constraints in timetabling can be hard or soft and

with respect to this, we can say, a timetabling problem consists assignment of a number of events

like courses, examinations, lectures, lab sessions, timeslots and so on into a given number of

timeslot and rooms while minimizing the violations of constraints.

2.3 CONSTRAINTS
The Examination Timetable Scheduling System is a combinatorial problem that can be solved

using several heuristics but the Constraint Programming is used in this case. This problem needs

examinations to be allocated to timeslots so that hard constraints are satisfied while the soft

8
constraints cost is minimized. The constraints are immensely different from one another and

from one examination timetabling problem to another.

HARD CONSTRAINTS
No student should be writing two examinations in the same timeslot.

No examination should be assigned a duration greater than the duration of the

examination.

The total number of students for a timeslot should not exceed the capacity of the room

but can be less than.

Some examinations must be assigned to a given room only e.g. Practical should be

allocated to practical rooms.

All 400level and above courses must be scheduled in the morning session.

All 100 level courses should be scheduled in the last session of the day.

SOFT CONSTRAINTS
A student can take a minimum of one exam a day and maximum of three examinations

a day.

In Each day, we can schedule examinations in one, two or three timeslots and a total of

nine examinations maximum and minimum of three examinations daily.

An examination can be assigned maximum number of three (3) rooms only.

Certain forms (frames) can be used for certain sessions only for instance Nursing Audit

should not be allocated for evening session examinations.

Some rooms have a limited number of time it can be used a day.

9
2.4 DIFFERENT HEURISTICS USED TO SOLVE TIMETABLING
PROBLEM
2.4.1 Simulated Annealing
(Citeseer, 1998) Simulated annealing was applied to the school timetabling problem. The atoms

correspond to elements of the timetable and the energy to the cost of the timetable. In order to

allow for scheduling to be more flexible, assignments are made to room groups instead of

individual rooms. If a group of classes must always take place at the same time, the classes should

be scheduled as a group instead of individually. The system was tested on randomly generated

problems and data from an Australian school. This solution is then improved using fast simulated

annealing.

2.4.2 Evolutionary Algorithms


A genetic algorithm was used to solve the school timetabling problem. A parallel algorithm is

applied to speed up the process. Each chromosome consists of n periods and each period contains

m tuples. The mutation operator changes the period of a tuple. Crossover is also applied to two

chromosomes by choosing a crossover point in each chromosome and swapping the fragments.

One child is returned which contains the first fragment of the first parent and the second

fragment of the second parent. Crossover may result in the “label replacement problem”, i.e. the

child may contain some duplicated and/or missing genes. A label replacement algorithm is used

to rectify this problem. The GA was used to solve nine highly constrained school timetabling

problems. Each element of the population is a matrix with the rows corresponding to the classes

and the columns to the periods. Each cell in the matrix stores the teacher that will teach the class

in the particular period. Initial studies indicated that crossover was not effective and time

consuming and hence it was not used. The period mutation operator swaps the teachers between

two time periods for a class. The periods chosen for swapping are randomly selected. The bad

10
period mutation operator does not randomly choose periods; instead the two “most costly”

periods in the corresponding teacher timetable are selected. Linear ranking selection is used to

choose parents. The best chromosome of each generation is copied into the next generation. This

algorithm successfully generated solutions to the Greek high school timetabling problem.

2.4.3 Tabu Search


Bello et al. (2008) treat the school timetabling problem as a graph coloring problem. An adjunct

graph is created and colored using an adaptation of the Tabu search algorithm for graph coloring

(Tabucol), namely, Modified Tabucol (MT). The system was applied to five instances from

Brazilian high schools. In the approach taken, an initial solution is firstly created using a

construction heuristic with a graph coloring algorithm. The initial solution is then improved

using Tabu search. The system was tested on data from German high schools.

2.4.4 Integer Programming


Earlier work by Birbas et al used integer programming to solve the school timetabling problem for
Greek high schools. This work is extended further in Birbas et al which takes a hybrid approach
to solving the problem.

Santos et al used mixed integer programming to solve the STP for Brazilian high schools. A cut
and column generation algorithm is implemented. The algorithm uses Fenchel cuts.

2.4.5 Constraint Programming


Constraint programming (CP) was used in combination with local search to solve the school
timetabling problem for Greek high schools. CP is used to find a feasible timetable. The quality of
the timetable is then improved using local search until further improvement is not possible. The
stopping criterion is a runtime of one hour.

2.4.6 GRASP
GRASP with path-relinking solved the STP for three Brazilian high schools. GRASP takes a three
stage approach to the problem. The first phase ranks lessons. During the second phase the ranking

11
is improved using local search. In the third phase a path relinking strategy is used to identify
optimal solutions. These three phases are repeated a number of times.

2.4.7 Tiling Algorithms


Kingston (Kingston 2004; Kingston 2006) uses a tiling algorithm in combination with hill-
climbing to allocate meetings (teacher and class tuples) and an alternating path algorithm for
assigning recourses to meetings after times are fixed. Meetings are firstly placed onto tiles and
then the tiles are timetabled. Resources are then allocated to meetings. Later research conducted
by Kingston (2008) investigates the use of a bipartite matching model, namely, global tixel
matching, to assign resources such as teachers and rooms to meetings. These algorithms have been
applied to Australian high schools.

2.4.8 Hybrid Approaches


Alvarez-Valdes et al.(1996) takes a three phase approach to the school timetabling problem. In the
first phase a parallel heuristic algorithm with priority rules is used to create an initial timetable
which is not usually feasible. Phase 2 applies a variation of the standard tabu search to the initial
timetable created in phase 1 to produce a feasible timetable. Phase 3 improves the quality of the
feasible timetable developed in phase 2. A graph theory approach, using the Floyd-Warshall
algorithm, is taken in this phase. This approach was tested on randomly generated problems and
data sets from 14 Spanish schools.

De Haan et al takes a four-phase approach to solving the STP. A preprocessing phase is conducted
to cluster events into clusters schemes using a branch-and-bound algorithm. The second and third
phases focus on constructing feasible timetables. The second phase assigns 329 lessons to day-

parts using a dynamic priority rule. The cluster with the lowest availability is scheduled first. If
this leads to unscheduled lessons the heuristic value is recalculated. During the third phase day-
parts are allocated to timeslots. A graph coloring first-fit heuristic is used for this.

The fourth phase uses a Tabu search to improve the feasible timetable. The system was
successfully applied to a data set from a Netherlands high school.

2.4.9 Comparative Studies


Colorni et al. (1998) compare the performance of simulated annealing, tabu search with local
search and genetic algorithms in solving the school timetabling problem for two Italian high

12
schools. The GA uses reproduction and crossover and applies mutation iteratively. Mutation swaps
a set of contiguous genes in the same row. Day mutation swaps two days in the same row. A
filtering algorithm is used to convert an infeasible offspring to a feasible one. Instead of creating
timetables from scratch the previous year’s handmade solution was used as a starting point. Tabu
search produced the best results followed by genetic algorithms and simulated annealing.

13
CHAPTER THREE

SYSTEM ANALYSIS
3.1 ANALYSIS OF PROPOSED SYSTEM
The proposed system shall be known as Examination Timetable Scheduling System and it is a

system that is aimed at solving the manual examination scheduling task in Madonna University,

Elele campus. The system will be designed and function based on several heuristics basically sub-

divided into examination to timeslot and examination to room allocation.

It grants access to Administrators who can edit, add and set constraints and to staff/students who

can only view the already generated timetable if any exists. The examination body or person in-

charge enters the data about resources and the system does the necessary jobs of setting bounds

through solving of constraints’ violation.

This system when fully designed and implemented will ensure that the work of timetabling in

Madonna University, Elele Campus easy and faster likewise grant staffs and students access to

timetables frequently.

3.2 SYSTEM FEASIBILITY


These are preliminary studies taken in the early stage of a project to establish its functionality.

OPERATIONAL FEASIBILITY
Examination Timetable Scheduling System when fully developed is user friendly as it

supports interfaces that are well designed and explanatory to users. It is also designed

in such a way that it violates none of the institution and social rules.

14
ECONOMIC FEASIBILITY
This project work will amidst all other benefits bring about a cut in the cost accrued

from manually developing the timetable which includes labor cost, time cost, reserve

cost and possibly cash cost also.

It will eliminate unnecessary time wastage, stress and other additional cost that come

up when doing the scheduling manually such as drawing and cancelling continuously;

moving from one office to another to make amends and so on.

S/N Item Unit Cost Quantity Total Cost

1. Printing of my report 20 98 1960

2. Download of Netbeans IDE 500 1 500

Total 2460

Table 3: Economic feasibility table


TECHNICAL FEASIBILITY
The ETSS is a solution that is practical to the Examination Timetabling Problem and the

technology used to implement it is Java Programming Language which is available to

the users and is a practical technology. Although not too skilled in the technology

enough effort was put in make sure a quality system is developed.

The technology also allows for data entry by the users, data retrieval and manipulation

on data that are entered likewise display of the generated output.

3.3 REQUIREMENT ANALYSIS


3.3.1 USER REQUIREMENTS
ETSS shall provide a screen called LoginUI to allow access to user and links to several

other interfaces.

15
ETSS shall provide several interfaces (java frames) for entering data concerning

resources and they shall be called SchoolUI, HallUI, CourseUI and their arrangement

will be SchoolUI before HallUI then CourseUI.

A user can enter and modify data during the course of running the system without

having to undergo much stress.

The examination timetable scheduling system will display error messages whenever

wrong or invalid data are inputted by user.

3.3.2 SYSTEM REQUIREMENT SPECIFICATIONS


3.3.2.1 Functional Requirements
These are statement of services the system should provide, how the system should react to certain

inputs and in given situations.

LoginUI: This screen comes up after the application has been launched to determine who

is trying to use the application. It provides two types of login, Administrative login with a

special password and Staff/Student login do with its own password also.

After the user logs in, either the SchoolUI or FinalTimetable screen comes up depending

on the login type (Administrative or Staff/Student Login).

Data can only be supplied by the Administrative users only while the Staff/Student users

can only retrieve data (generated timetable).

ETSS should satisfy all of the hard constraints and some or little of the soft constraints.

The application should be able to move from one point of the program to another either

to and fro.

16
3.3.2.2 Non-Functional Requirements

Product Requirement

The user interfaces for ETSS shall be designed in JAVA as java frames and after this, the

application shall be installed on the user’s PC for availability to the targeted output.

Organizational Requirements

This project work must conform to the rules and regulations of the Department of Computer

Science of Madonna University regarding project reporting.

External Requirements

Only the administrative users have access to all information stored on the system while the ETSS

shall also allow for modification by the administrative user only.

The source code for the system shall be handled by the programmer only while the application

will be installed on the devices of the organization.

3.3.3 HARDWARE REQUIREMENTS


S/NO Hardware Features What it will be used for

Component

1. A Laptop or Desktop Intel Pentium 2.0GHz or This hardware component

higher processor; will have the Netbeans 8.0.2

IGB ram or higher version; IDE and JAVA SDK installed

80GB hard disk or higher on it likewise Microsoft

Word. This is to aid

programming and

compilation of this project

work.

17
2. 2 USB flash drives 2GB or above capacity For transfer of the project

application, Netbeans IDE,

Microsoft Office and other

necessary files.

3. Printer Either networked or not. For printing of the project

report and other

documentation needed to be

printed out.

4. 2 Compact Disk 760MB or more For storage of the completed

project documentations,

application and user manuals

if any for reference purpose

and possible installation in

future on users’ system.

Table 4: Hardware Requirements


3.3.4 SOFTWARE REQUIREMENTS
S/NO Software Component Features What it will be used for

1. Windows Operating Windows XP, 7, 8, 8.1 or It will be installed in the

System 10 machine of the user and the

programmer for design of the

work by the programmer and

testing by the user.

18
2. Netbeans IDE Version 7 or 8 and also Used for interface design and

support Java programming access to Java programming

for writing of codes for

implementation of the design.

3. Microsoft Word MS-Word 2007, 2010 or This will be used for

2013 documentations and other

report writing.

4. Snipping tool Ability to capture screen It will be used to capture

images images of interfaces during

implementation and testing of

the ETSS.

Table 5: Software Requirements

19
CHAPTER FOUR

SYSTEM DESIGN
4.1 DESIGN METHODOLOGY
Examination Timetable Scheduling System is a system that will be designed to allow for entry

and modification of data through several interfaces that have been designed as java frames and

also allows for interaction between users and the system to be easy and educative.

Object-Oriented decomposition architectural model is been used for the design process of

Examination Timetable Scheduling System (ETSS), this is so because it is a system that supports a

set of loosely coupled objects with well-defined interfaces (LoginUI, SchoolUI, HallUI, CourseUI,

FinalTimetable) that interact with one another likewise calls services offered by each other when

necessary.

The control system used is an Event-driven control system as each sub-system is responsive to

externally generated events and some of these events come from other sub-systems or the

system’s environment.

LoginUI SchoolUI HallUI CourseUI FinalTimetable

Event and Message Handler

Figure 1: Event driven control system for ETSS

20
4.2 ALGORITHM OF IMPLEMENTATION
The Examination Timetabling Scheduling System was implemented using the following

procedures:

The user inputs the necessary inputs

Grouping: At this stage, the courses entered are grouped according to their levels that is

FinalYears, ThirdYears, SecondYears, FirstYears and None (for those courses that were not

inputted with level).

Time-slotting: This has to do with allocating the courses to timeslots. There are sixty-eight

(68) timeslots and each timeslot is meant to carry at least three (3) exams and at most six

(6) exams. Now when course are entered, the courses after been grouped is picked

together with the course code, department and number of students taking the course. This

values will be used to determine the placements for the courses.

Room allocation: The timeslots are assigned rooms based on the total number of students

taking all the exams in that timeslot. This value is gotten by summing together the number

of students taking the whole courses assigned to that timeslot.

4.3 SYSTEM FLOWCHART


A flowchart is a diagrammatic or pictorial representation of how a system (the ETSS) will pass

control and operate. It gives a clear though not very precise view of the communications existing

between the interfaces or sub-system. Several diagrams are used to depict different meaning.

21
Start

LoginUI

No Is Login details correct?

Yes

If LoginPassword

=”examschadmin”

Yes no

SchoolUI

No

Are details complete?

Yes

HallUI

No
Are details complete?

No

Yes
Comple

te data? CourseUI

Yes
FinalTimetable

Figure 2: System Flowchart Stop

22
Start

LoginUI

LoginUsername and LoginPassword

Storage of username and

password
FinalTimetable
No

FinalTimetable
Correct data?

Yes

No

FinalTimetable
Password =

“examschadmin”

Yes

SchoolUI

Stop

Figure 3: LoginUI flowchart

23
Start

SchoolUI

Filling of details by user

Error message
Storing into variables

No
Validation?

Yes

HallUI

Stop

Figure 4: SchoolUI flowchart

24
Start

HallUI

Fill in data

Store in variables

No
Is data correct?

Yes

Increment Hall counter

No Hall counter = HallNo?

Yes

CourseUI

Stop
Figure 5: HallUI flowchart

25
Start

CourseUI

Enter data…

Is data correct? Error message


Yes No

Exam grouping

Assign exam to timeslots

No
Successful?

Yes
Room assignment

No Courses finished?

Yes

Generate timetable

FinalTimetableUI

Stop

Figure 6: CourseUI flowchart

26
4.4 INTERFACE DESIGN
Login Interface
LoginUI Form Login form

LoginFrame
Username: txtUsername

Password: pswPassword

btnLogin
lblPassword

btnExit
lblUsername

27
School Information Interface

txtSchoolName
School name:

Session: txtSession

txtSemester
Semester:

School Location: txtLocation

txtFacNum
No of Fac.

cmbExamDays

Exam days: Dept. NO


cmbDeptNum

Back Ok Cancel

btnBack btnOk btnCancel

28
Hall Information Interface

No of Halls:
Ok btnOk

txtNoOfHalls

Hall Name: cmbHallName

cmbHallLocation
Hall Location:

Num. Of Seats: txtSeatNum

cmbAvailability
Availability:

Department: cmbDepartment

cmbHallID
Hall ID:

cmbHallUsage
Hall Usage:

Back Add Next

btnHallBack btnHallAdd btnHallNext

29
Course Information Interface

txtCourseTitle
Course Title:

Course Code: txtCourseCode

txtLecturer
Lecturer:

cmbCourseFaculty
Faculty:

cmbCourseDept
Department:

txtStudNum

Num of Student:
Level: cmbCLevel

cmbDuration

Duration: C Type
cmbCType

Back Add Next

btnCourseBack btnCourseAdd btnCourseNext

30
Final Timetable Interface

Day Time Exam 1 Exam 2 Exam 3 Exam 4 Exam 5 Exam 6 Hall

Back Generate Exit

tblFinalTTable
btnFinalBack btnFinalGen btnFinalExit

4.5 DATAFLOW DIAGRAM


This extends the behavioral model and it is an intuitive diagram that shows how data is processed

by the system specifying inputs and outputs of the processed inputs at each stage.

They help analysts of the proposed system understand what is going on throughout though not

full information is given concerning what is really going on. It shows the entire sequence of

actions that take that take place from input being processed to the corresponding output.

Figure 7: Data flow diagram for ETSS

31
Username&Password LoginUI validation Valid username&password Valid data analysis FTimetable

Admin Login Data

SchoolUI

Institution’s information

Checking and Storage

Number of halls and course

Inter-component transmitter

Converted value for hall number

HallUI
Data analysis and storage Data entered

Hall_ID and Hall_Num

Inter-component transmitter

Converted data
CourseUI

Data entered

Phase 1: Time slotting

Feasible solution

Phase 2: Hall Assignment

Optimum solution
Timetable generator

32
4.6 CLASS DIAGRAM

LoginUI (JFrame )

LoginCount: int
LoginPassword: String
LoginUsername: String
School: SchoolUI
Timetable: FinalTimetable
btnExit: JButton
btnLogin: JButton
lblPassword: JLabel
lblUsername: JLabel
loginFrame: JInternalFrame
null1: String
pswPassword: JPasswordField
txtUsername: JTextField

btnExitActionPerformed (ActionEvent evt)


btnLoginActionPerformed (ActionEvent evt)
btnLoginKeyPressed (KeyEvent evt)
exit()
initComponents()
main(String args[])
pswPasswordFocusLost(FocusEvent evt)
txtUsernameFocusLost(FocusEvent evt)

Figure 8: Class diagram for LoginUI

33
SchoolUI (JFrame )

AcademicSemester: int
AcademicSession: String
ExamDays: String
InstitutionCount: int
InstitutionLocation: String
InstitutionName: String
NumOfCourses: int
NumOfDept: int
NumOfFaculties: int
NumOfHalls: int
Zero: int
btnBack: JButton
btnOk: JButton
cmbDeptNum, cmbExamDays: JComboBox
cmbSchoolLocation: JComboBox
cmbSemester, cmbSession: JComboBox
JInternalFrame1: JInternalFrame
lblExamDays, lblDeptNum : JLabel
lblFacultyNum, lblLocation: JLabel
lblSchoolName: JLabel
lblSemester: JLabel

btnBackActionPerformed(ActionEvent evt)
btnCancelActionPerformed(ActionEvent evt)
btnOkActionPerformed(ActionEvent evt)
exit()
initComponents()
main(String[] args)
txtFacultyNumFocusLost(FocusEvent evt)
txtSchoolNameFocusLost(FocusEvent evt)

Figure 9: Class diagram for SchoolUI

34
4.6 TEST PLAN

This is a briefing on the test samples to be used for the testing stage which will be covered in

chapter five of this report. The test plan gives a first-hand detail and straight to the point detail

concerning the test data, test cases and other necessary details that makes up the testing phase.

Test No Test value Test case Test data Expected Result Actual result

1. LoginUsername & Wrong Null (for both) Rejected Please enter the

LoginPassword LoginUsername correct details

and to continue

LoginPassword

2. LoginUsername & Correct “Dr.Phillipe” for Rejected Please enter

LoginPassword LoginUsername LoginUsername password first

& Wrong & null for

LoginPassword LoginPassword

3. LoginUsername and Wrong Null for Rejected Please enter the

LoginPassword LoginUsername LoginUsername correct data to

and Correct and continue

LoginPassword “examschadmin”

for

LoginPassword

4. InstitutionName Null Null Rejected Please enter

(txtSchoolName.lostFocus) value for

school name

5. Academic Session Null Null Rejected Please enter

value for

session school

is in

6.

35
Table 6: Test Plan for ETSS

36
CHAPTER FIVE

SYSTEM IMPLEMENTATION
5.1 LANGUAGE OF IMPLEMENTATION
Java Programming Language was the language used to implement this system (ETSS) and the

Netbeans 8.0.2 IDE was also used to actualize this owing to its good interface design capabilities

and support of Java programming.

Java Programming Language is an Object oriented and event driven programming language that

supports the concept of inheritance of classes, functions and other features. It also supports for

abstraction and is highly portable because it is platform independent.

37
Figure 10: Netbeans IDE

Figure 11: Netbeans IDE coding environnent


5.2 DESIGN IMPLEMENTATION
LoginUI Interface

This is the first interface to come up when the program starts. This interface is responsible for

deciding where control goes next, whether it is final timetable or the school information interface

and this is determined by data entered by the user in question.

38
School UI Interface

The SchoolUI interface is like all other interface, they are built as Java frames and this interface

allows for entering of information concerning the institution that want to make use of the

application. It also passes data to both the HallUI and CourseUI interfaces respectively.

39
Hall UI Interface

Information about the various halls obtainable and used in the institution (Madonna University,

Elele) for examinations.

40
Course UI Interface

This allows for entering of values concerning the courses to be allocated and used to generate
the timetable. It communicates with other interfaces more frequently.

Final Timetable Interface

Used to display the final timetable that will be generated.

41
5.3 TESTING
5.3.1 UNIT TESTING
Test No Test value Test case Test data Exp. Result Actual result

1. LoginUsername & Wrong Null (for both) Rejected Please enter the

LoginPassword LoginUsername and correct details

LoginPassword to continue

2. LoginUsername & Correct “Dr.Phillipe” for Rejected Please enter

LoginPassword LoginUsername & LoginUsername & password first

Wrong null for

LoginPassword LoginPassword

3. LoginUsername & Wrong Null for Rejected Please enter the

LoginPassword LoginUsername and LoginUsername and correct data to

Correct “examschadmin” for continue

LoginPassword LoginPassword

Table 7: LoginUI Unit testing

Figure 12: LoginUI unit test 1


This is the case where the user enters null values for both username and password.

42
Figure 13: Login UI unit test 2
Here, the user entered the username value but ignores the filed for password and that is not

accepted by the program thus the program is halted.

Figure 14: LoginUI unit test 3


Unit test 3 is aimed at capturing error whereby the password is inputted correctly but nothing

is inputted for a username.

43
4. InstitutionName Null Null Rejected Please enter

(txtSchoolName.lostFocus) value for

school name

5. Academic Session Null Null Rejected Please enter

value for

session school

is in

Table 8: SchoolUI unit testing

Figure 15: SchoolUI unit test 1


This is a test that takes place once focus is released by the textbox that holds school name. The

test checks for null value input into the textbox.

44
Figure 16: School UI unit test 2
Similar to the one above, but this is in respect to the academic session the school is operating

when the timetable is been scheduled.

5.3.2 MACHINE TESTING


The application was copies and run in several machine with different specification and it

functioned appropriately but refused functioning well in one of the system that does not have a

Java SDK and the Netbeans IDE installed on it.

The program executed correctly on the following machines though not all functionalities of the

program were properly working:

A windows 7 machine with Java SDK version 6 installed on it

Windows 8 and 8.1 machine that has Java SDK installed on it also likewise the Netbeans

IDE.

45
The application was also found to be compatible on both 32bits and 64bits machines without

selection.

5.4 SYSTEM COUPLING


5.4.1 SOFTWARE INSTALLATION GUIDE
Get the CD that has the program stored in it

Insert the software installation CD into the machine’s CD drive and open its content.

Run the installer

Follow the steps that come up until the installation finished.

5.4.2 SYSTEM REQUIREMENT


5.4.2.1 SUPPORTED OPERATING SYSTEM
Windows 7, 8 or 8.1

5.4.2.2 MINIMUM HARDWARE REQUIREMENTS


2 GHz Intel Pentium or higher processor

AMD processor

1 GB of Ram

8GB of Hard disk space

5.4.2.3 MINIMUM SOFTWARE REQUIREMENT


Java development kit

5.4.3 TROUBLESHOOTING
In cases of failure or malfunction of the program, the user should reboot the system the program

is installed in and if the problem persists, the programmer should be called upon to check the

system.

5.4.4 USER MANUAL


The application has been built to be in such a way that it is user friendly and easy to learn also.

46
CHAPTER SIX

SUMMARY, CONCLUSION AND


RECOMMENDATION
6.1 SUMMARY
This research is an educational research that is aimed at improving the programming skill of the

researcher likewise examine the two main techniques of examination timetable scheduling

(Manual and Computerized) then bring to light the importance of switching to the computerized

scheduling system.

6.2 LESSON LEARNT


Though my proposed system was not fully implemented but I have been able to learn the Java

programming language to a moderate level with which I can write Java projects with less

difficulty unlike some months ago. Also I have been able to figure out the benefits of using the

computerized system of examination scheduling and its importance in examination timetable

problem.

6.3 FUTURE TRENDS


Well in the nearest future a database system will be introduced so as to capture details

concerning scheduled courses likewise a networked system will be developed whereby the

scheduling will not have to be by the examination body alone but all departments then the

examination body on receives the schedule then combine them into one timetable.

6.4 CONCLUSION
Examination Timetable Scheduling System is an automated system that eliminates scheduling

examinations manually and lightens the burden that comes with manual timetable generation.

47
This research work also draws the conclusion that computerized timetable generation saves time

and energy as compared to the manual one.

6.5 RECOMMENDATION
More functionality could be added which due to time constraint and advanced skill in Java

programming those features were not applied.

48
REFERENCES
Banzhaf, P. a. (2009). A study of heuristic combinations for hyper-heuristic systems for the

uncapacitated examination timetabling problems. European Journal of Operations

REsearch, 482 - 491.

C. Gorgos , P.Alefragis, and E.Houses. (2008). A multi-staged algorithmic process for the solution

of the examination timetabling problem. . Practice and Theory of Automated Timetabling,

19-22.

Citeseer. (1998, 09 12). downloads. Retrieved from Citeseer website:

citeseer.ist.psu.edu/viewdoc/download?doi = 10.1.1.53.2679&rep = 12044.pdf

E.K Burke and J.P Newall. (2004). Solving Examination Timetabling Problems through adaptation

of heuristic orderings. Annals of Operations Research, 107-134.

E.K Burke and J.P Newall. (2006). Solving Examination Problems. Technical Report NOTTCS-TF.

School of Computer Science and IT, University of Nottingham, 2.

Ibhn, M. (2004, April 12). Muhammad Ibhn's profile. Retrieved from An Academia website:

www.academia.edu/2812582/Evolutionary_Algorithms_in_lecture_timetabling

Jha, S. K. (2014). Exam timetabling problem using genetic algorithm. IJRET, 105.

Oyebanjo, A. (2012, 04 20). University Timetable Automation Using Genetic Algorithm.

Retrieved from Academia 8506247: www.academiaedu

49
APPENDIX

LoginUI codes:
package ExamTimetabler;
/**
* @author Oroke Kenneth Augustine
*/
import java.awt.Toolkit;
import java.awt.event.WindowEvent;
import javax.swing.JOptionPane;
//import java.sql.*;
//import static java.sql.DriverManager.getConnection;

public class LoginUI extends javax.swing.JFrame {

String LoginUsername;
String LoginPassword;
int LoginCount;
String null1 = "";
SchoolUI School;
FinalTimetable Timetable;

public LoginUI() {
this.Timetable = new FinalTimetable();
this.School = new SchoolUI();
initComponents();
}

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

loginFrame = new javax.swing.JInternalFrame();


lblUsername = new javax.swing.JLabel();
lblPassword = new javax.swing.JLabel();
txtUsername = new javax.swing.JTextField();
pswPassword = new javax.swing.JPasswordField();
btnLogin = new javax.swing.JButton();
btnExit = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Login Form");
setForeground(new java.awt.Color(0, 51, 51));

loginFrame.setName(""); // NOI18N
loginFrame.setNextFocusableComponent(this);
loginFrame.setVisible(true);

lblUsername.setBackground(new java.awt.Color(255, 255, 255));


lblUsername.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
lblUsername.setText("Username: ");
lblUsername.setToolTipText("");

lblPassword.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


lblPassword.setText("Password: ");

txtUsername.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {

50
txtUsernameFocusLost(evt);
}
});

pswPassword.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
pswPasswordFocusLost(evt);
}
});

btnLogin.setBackground(new java.awt.Color(255, 255, 255));


btnLogin.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnLogin.setText("Login");
btnLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLoginActionPerformed(evt);
}
});
btnLogin.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
btnLoginKeyPressed(evt);
}
});

btnExit.setBackground(new java.awt.Color(255, 255, 255));


btnExit.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnExit.setText("Exit");
btnExit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnExitActionPerformed(evt);
}
});

javax.swing.GroupLayout loginFrameLayout = new javax.swing.GroupLayout(loginFrame.getContentPane());


loginFrame.getContentPane().setLayout(loginFrameLayout);
loginFrameLayout.setHorizontalGroup(
loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loginFrameLayout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblPassword, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblUsername, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtUsername)
.addComponent(pswPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
.addGroup(loginFrameLayout.createSequentialGroup()
.addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 87,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 83,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(73, Short.MAX_VALUE))
);
loginFrameLayout.setVerticalGroup(
loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(loginFrameLayout.createSequentialGroup()
.addContainerGap()
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

51
.addComponent(lblUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(loginFrameLayout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(txtUsername)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pswPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55, Short.MAX_VALUE)
.addGroup(loginFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
.addComponent(btnExit, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(29, 29, 29))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(loginFrame)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(loginFrame, javax.swing.GroupLayout.Alignment.TRAILING)
);

getAccessibleContext().setAccessibleParent(this);

pack();
}// </editor-fold>

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {


txtUsername.setText("bye");
exit();

}
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {
/* variable initialization */
LoginUsername = txtUsername.getText();
LoginPassword = pswPassword.getText();
boolean LoginU;
LoginU = LoginUsername.isEmpty();
/*validation on variables*/
// both empty
if (LoginPassword.isEmpty() && LoginUsername.isEmpty()) {
exit();
JOptionPane.showMessageDialog(null, "Please enter the correct data to continue", "Login Error Message",
JOptionPane.ERROR_MESSAGE);
} // only one empty
else if (LoginPassword.isEmpty() || LoginUsername.isEmpty()) {
exit();
JOptionPane.showMessageDialog(null, "Please enter the correct data to continue", "Login Error Message",
JOptionPane.ERROR_MESSAGE);
} // different user aside admin users.
else if ((LoginUsername.isEmpty()) && (LoginPassword.equals("examschss"))) {

52
exit();
FinalTimetable FTimetable = new FinalTimetable();
FTimetable.setVisible(true);
} //admin login
else if (LoginUsername.equals("Dr. Atabong") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Dr. Phillipe") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Dr. Chuks Ezedum") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Fr. Founder") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else {
exit();
}
}

private void txtUsernameFocusLost(java.awt.event.FocusEvent evt) {


}
private void pswPasswordFocusLost(java.awt.event.FocusEvent evt) {
LoginPassword = pswPassword.getText();
if (LoginPassword.isEmpty()) {
JOptionPane.showMessageDialog(null, "Please enter password first", "Input not entered",
JOptionPane.ERROR_MESSAGE);
}
}

private void btnLoginKeyPressed(java.awt.event.KeyEvent evt) {


/* variable initialization */
LoginUsername = txtUsername.getText();
LoginPassword = pswPassword.getText();
boolean LoginU;
LoginU = LoginUsername.isEmpty();
if (LoginPassword.isEmpty() && LoginUsername.isEmpty()) {
exit();
JOptionPane.showMessageDialog(null, "Please enter the correct data to continue", "Login Error Message",
JOptionPane.ERROR_MESSAGE);
} // only one empty
else if (LoginPassword.isEmpty() || LoginUsername.isEmpty()) {
exit();
JOptionPane.showMessageDialog(null, "Please enter the correct data to continue", "Login Error Message",
JOptionPane.ERROR_MESSAGE);
} // different user aside admin users.
else if ((LoginUsername.isEmpty()) && (LoginPassword.equals("examschss"))) {
exit();
FinalTimetable FTimetable = new FinalTimetable();

53
FTimetable.setVisible(true);
} //admin login
else if (LoginUsername.equals("Dr. Atabong") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Dr. Phillipe") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Dr. Chuks Ezedum") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else if (LoginUsername.equals("Fr. Founder") && (LoginPassword.equals("examschadmin"))) {
LoginUsername = "";
LoginPassword = "";
exit();
School.setVisible(true);
LoginCount++;
} else {
exit();
}
}

public static void main(String args[]) {


//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LoginUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LoginUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LoginUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LoginUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnExit;
private javax.swing.JButton btnLogin;

54
private javax.swing.JLabel lblPassword;
private javax.swing.JLabel lblUsername;
private javax.swing.JInternalFrame loginFrame;
private javax.swing.JPasswordField pswPassword;
public javax.swing.JTextField txtUsername;
// End of variables declaration

private void exit() {


WindowEvent CloseWindow = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(CloseWindow);
} }

SchoolUI Codes:
package ExamTimetabler;

import java.awt.Toolkit;
import java.awt.event.WindowEvent;
import javax.swing.JOptionPane;

public class SchoolUI extends javax.swing.JFrame {

int NumOfCourses, NumOfFaculties, NumOfHalls, NumOfDept, AcademicSemester, InstitutionCount;


String InstitutionName, AcademicSession, InstitutionLocation, ExamDays;
final int Zero;

public SchoolUI() {
this.Zero = 0;
initComponents();
}

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jInternalFrame1 = new javax.swing.JInternalFrame();


lblSchoolName = new javax.swing.JLabel();
lblSession = new javax.swing.JLabel();
lblSemester = new javax.swing.JLabel();
lblLocation = new javax.swing.JLabel();
txtSchoolName = new javax.swing.JTextField();
lblFacultyNum = new javax.swing.JLabel();
cmbSemester = new javax.swing.JComboBox();
lblExamDays = new javax.swing.JLabel();
txtFacultyNum = new javax.swing.JTextField();
btnBack = new javax.swing.JButton();
btnOk = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
lblDeptNum = new javax.swing.JLabel();
cmbDeptNum = new javax.swing.JComboBox();
cmbExamDays = new javax.swing.JComboBox();
cmbSchoolLocation = new javax.swing.JComboBox();
cmbSession = new javax.swing.JComboBox();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("School Information");

jInternalFrame1.setForeground(new java.awt.Color(102, 0, 102));


jInternalFrame1.setVisible(true);

lblSchoolName.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblSchoolName.setForeground(new java.awt.Color(102, 0, 102));
lblSchoolName.setText("School Name:");

55
lblSession.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblSession.setForeground(new java.awt.Color(102, 0, 102));
lblSession.setText("Session:");

lblSemester.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblSemester.setForeground(new java.awt.Color(102, 0, 102));
lblSemester.setText("Semester:");

lblLocation.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblLocation.setForeground(new java.awt.Color(102, 0, 102));
lblLocation.setText("School Location:");

txtSchoolName.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtSchoolNameFocusLost(evt);
}
});

lblFacultyNum.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblFacultyNum.setForeground(new java.awt.Color(102, 0, 102));
lblFacultyNum.setText("Number of Faculties: ");

cmbSemester.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbSemester.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "First", "Second" }));

lblExamDays.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblExamDays.setForeground(new java.awt.Color(102, 0, 102));
lblExamDays.setText("Examination Days:");

txtFacultyNum.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtFacultyNumFocusLost(evt);
}
});

btnBack.setBackground(new java.awt.Color(255, 255, 255));


btnBack.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnBack.setText("Back");
btnBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBackActionPerformed(evt);
}
});

btnOk.setBackground(new java.awt.Color(255, 255, 255));


btnOk.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnOk.setText("Ok");
btnOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnOkActionPerformed(evt);
}
});

btnCancel.setBackground(new java.awt.Color(255, 255, 255));


btnCancel.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});

56
lblDeptNum.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblDeptNum.setForeground(new java.awt.Color(102, 0, 102));
lblDeptNum.setText("Number of Department:");

cmbDeptNum.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbDeptNum.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" }));

cmbExamDays.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbExamDays.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Mon-Sat" }));

cmbSchoolLocation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Okija", "Elele",


"Akpugo" }));

cmbSession.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "2014/2015", "2015/2016",


"2016/2017", "2017/2018" }));

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblExamDays, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbExamDays, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblFacultyNum)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtFacultyNum, javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(130, 130, 130)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblDeptNum, javax.swing.GroupLayout.PREFERRED_SIZE, 125,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(btnBack, javax.swing.GroupLayout.PREFERRED_SIZE, 111,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24)))
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(btnOk, javax.swing.GroupLayout.PREFERRED_SIZE, 105,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 105,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(cmbDeptNum, javax.swing.GroupLayout.PREFERRED_SIZE, 78,
javax.swing.GroupLayout.PREFERRED_SIZE)))

57
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblSchoolName, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtSchoolName, javax.swing.GroupLayout.PREFERRED_SIZE, 212,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblSession, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbSession, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbSchoolLocation, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(lblSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cmbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 100,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(41, Short.MAX_VALUE))
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblSchoolName, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtSchoolName, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(cmbSession))
.addComponent(lblSession, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(lblLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(cmbSchoolLocation)
.addGap(10, 10, 10)))

58
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblFacultyNum, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtFacultyNum, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblDeptNum, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblExamDays, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbDeptNum, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbExamDays, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(37, 37, 37)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnBack)
.addComponent(btnOk)
.addComponent(btnCancel))
.addContainerGap())
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jInternalFrame1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jInternalFrame1)
.addGap(77, 77, 77))
);

jInternalFrame1.getAccessibleContext().setAccessibleName("IntFrameUI");

pack();
}// </editor-fold>
private void btnBackActionPerformed(java.awt.event.ActionEvent evt) {
txtSchoolName.setText("bye bye");
cmbSession.setSelectedIndex(-1);
cmbSemester.setSelectedIndex(-1);
cmbSchoolLocation.setSelectedIndex(-1);
txtFacultyNum.setText("");
cmbExamDays.setSelectedIndex(-1);
InstitutionCount = 0;
InstitutionCount = (InstitutionCount - 1); /* to know how many institution made use or logged into the system */

exit();
LoginUI Login = new LoginUI();
Login.setVisible(true);
Login.txtUsername.setEnabled(false);

59
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {

InstitutionName = txtSchoolName.getText();
AcademicSession = (String) cmbSession.getSelectedItem();
AcademicSemester = cmbSemester.getSelectedIndex();
InstitutionLocation = (String) cmbSchoolLocation.getSelectedItem();
NumOfFaculties = Integer.parseInt(txtFacultyNum.getText());
ExamDays = (String) cmbExamDays.getSelectedItem(); /*extrnal variable casting*/

// NumOfHalls = Integer.parseInt(txtNumOfHalls.getText());
NumOfDept = cmbDeptNum.getSelectedIndex();

// validation
//empty instituttion name and location
if (InstitutionName.isEmpty() && InstitutionLocation.isEmpty()) {

if (AcademicSession.isEmpty());
if (InstitutionLocation == null);
if ((NumOfFaculties == Zero) && (NumOfCourses == Zero));
if ((NumOfDept == Zero));
JOptionPane.showMessageDialog(null, "Please enter complete values first", "No input entered:",
JOptionPane.ERROR_MESSAGE);

} else if (InstitutionName.isEmpty() || InstitutionLocation.isEmpty()) {


JOptionPane.showMessageDialog(null, "Please enter value for Institution name and location", "No input
entered:", JOptionPane.ERROR_MESSAGE);
} else if ((AcademicSemester < 0)) {
JOptionPane.showMessageDialog(null, "Please enter right value for Semester.", "Wrong input entered:",
JOptionPane.ERROR_MESSAGE);
} else if ((NumOfFaculties == Zero) || (NumOfCourses == Zero)) {
JOptionPane.showMessageDialog(null, "Please enter values for the total number of faculties and courses to be
scheduled", "No input entered:", JOptionPane.ERROR_MESSAGE);
} else if ((NumOfDept == Zero)) {
JOptionPane.showMessageDialog(null, "Please enter complete values first", "No input entered:",
JOptionPane.ERROR_MESSAGE);
} else if ((NumOfFaculties == Zero) && (NumOfCourses == Zero)) {
if ((NumOfDept == Zero));
if (AcademicSession.isEmpty());
if (InstitutionLocation == null);
if ((NumOfFaculties == Zero));
JOptionPane.showMessageDialog(null, "Please enter complete values first", "No input entered:",
JOptionPane.ERROR_MESSAGE);
} else {
exit();
HallUI Halls = new HallUI();
Halls.setVisible(true);
// new HallUI(NumOfHalls).setVisible(true);
InstitutionCount++; // holds number of institutions that logged in to the system
}

}
private void txtSchoolNameFocusLost(java.awt.event.FocusEvent evt) {

if (txtSchoolName.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Please enter value for school name", "Input not entered",
JOptionPane.ERROR_MESSAGE);
}
}
private void txtFacultyNumFocusLost(java.awt.event.FocusEvent evt) {
NumOfFaculties = Integer.parseInt(txtFacultyNum.getText());
}

60
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
InstitutionName = "";
AcademicSession = "";
InstitutionLocation = "";
NumOfFaculties = Zero;
NumOfCourses = Zero;
ExamDays = "";
this.setVisible(true);
int Reply = JOptionPane.showConfirmDialog(null, "Please do you want to continue?");

if (Reply == 0) {
this.setVisible(true);
} else if (Reply == 1) {
this.setVisible(false);
LoginUI Login = new LoginUI();
Login.setVisible(true);
} else {
exit();
}
}

public static void main(String args[]) {

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SchoolUI().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JButton btnBack;
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnOk;
private javax.swing.JComboBox cmbDeptNum;
private javax.swing.JComboBox cmbExamDays;
private javax.swing.JComboBox cmbSchoolLocation;
private javax.swing.JComboBox cmbSemester;
private javax.swing.JComboBox cmbSession;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel lblDeptNum;
private javax.swing.JLabel lblExamDays;
private javax.swing.JLabel lblFacultyNum;
private javax.swing.JLabel lblLocation;
private javax.swing.JLabel lblSchoolName;
private javax.swing.JLabel lblSemester;
private javax.swing.JLabel lblSession;
private javax.swing.JTextField txtFacultyNum;
private javax.swing.JTextField txtSchoolName;
// End of variables declaration

private void exit() {


WindowEvent CloseWindow = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(CloseWindow);

}
}

61
HallUI Codes:
package ExamTimetabler;

import java.awt.Toolkit;
import java.awt.event.WindowEvent;
import javax.swing.JOptionPane;

/**
* @author Oroke Kenneth Augustine
*/
public class HallUI extends javax.swing.JFrame {

SchoolUI School = new SchoolUI();


String none = "";
int hallcounter;
int HallCount, HallCounter1, NumOfSeatsCopy;
String HallNameCopy, HallLocationCopy, HallDeptCopy;
int HallAvailabilityCopy, HallIDCopy, UsageOfHallCopy, HallCapacity1;
String[] HallName;
String[] HallLocation;
String[] HallDept;
int[] HallAvailability;
int[] NumOfSeats;
int[] HallID;
int[] UsageOfHall;
int[] NumOfSeatsStat;

/**
* Creates new form HallUI
*/
//default constructor
public HallUI() {
this.hallcounter = 15;

this.HallName = new String[15];


this.HallLocation = new String[hallcounter];
this.HallDept = new String[hallcounter];
this.HallAvailability = new int[hallcounter];
this.NumOfSeats = new int[hallcounter];
this.HallID = new int[hallcounter];
this.UsageOfHall = new int[hallcounter];
this.NumOfSeatsStat = new int[hallcounter];

initComponents();
}

//public HallUI(int HallNum1) {


// HallCounter = HallNum1;
// initComponents();
//}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jInternalFrame1 = new javax.swing.JInternalFrame();


jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();

62
cmbHallName = new javax.swing.JComboBox();
txtSeatNum = new javax.swing.JTextField();
cmbAvailability = new javax.swing.JComboBox();
cmbDepartment = new javax.swing.JComboBox();
cmbHallID = new javax.swing.JComboBox();
cmbHallUsage = new javax.swing.JComboBox();
btnHallAdd = new javax.swing.JButton();
btnHallNext = new javax.swing.JButton();
btnHallBack = new javax.swing.JButton();
cmbHallLocation = new javax.swing.JComboBox();
HallCapacityLabel = new javax.swing.JLabel();
HallCapacity = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Hall Information");

jInternalFrame1.setForeground(new java.awt.Color(102, 0, 102));


jInternalFrame1.setVisible(true);

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel1.setForeground(new java.awt.Color(102, 0, 102));
jLabel1.setText("Hall Name:");

jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel2.setForeground(new java.awt.Color(102, 0, 102));
jLabel2.setText("Hall Location:");

jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel3.setForeground(new java.awt.Color(102, 0, 102));
jLabel3.setText("Number of Seats:");

jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel4.setForeground(new java.awt.Color(102, 0, 102));
jLabel4.setText("Availability:");

jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel5.setForeground(new java.awt.Color(102, 0, 102));
jLabel5.setText("Department:");

jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel6.setForeground(new java.awt.Color(102, 0, 102));
jLabel6.setText("Hall ID:");

jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel7.setForeground(new java.awt.Color(102, 0, 102));
jLabel7.setText("Hall Usage:");

cmbHallName.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbHallName.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Science Hall",
"Pharmacy1", "Pharmacy2", "Nursing Audit", "General Audit", "IC 1", "IC 2", "IC 3", "BC 1", "BC 2", "BC 3", "CS
1", "CS 2", "CS 3", "Perfect Exam Hall", " ", " " }));
cmbHallName.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
cmbHallNameFocusLost(evt);
}
});

txtSeatNum.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


txtSeatNum.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtSeatNumFocusLost(evt);
}

63
});

cmbAvailability.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbAvailability.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Not Available",
"Available", "Highly Available" }));

cmbDepartment.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbDepartment.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Anatomy",
"Biochemistry", "Computer Science", "Industrial Chemistry", "MLS", "Medicine and Surgery", "Microbiology",
"Nursing Science", "Pharmacy", "Physiology", " " }));

cmbHallID.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbHallID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "001", "002", "003", "004",
"005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015" }));
cmbHallID.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
cmbHallIDFocusLost(evt);
}
});

cmbHallUsage.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbHallUsage.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Theory", "Practicals", "Both"
}));

btnHallAdd.setBackground(new java.awt.Color(255, 255, 255));


btnHallAdd.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnHallAdd.setText("Add");
btnHallAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHallAddActionPerformed(evt);
}
});

btnHallNext.setBackground(new java.awt.Color(255, 255, 255));


btnHallNext.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnHallNext.setText("Next");
btnHallNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHallNextActionPerformed(evt);
}
});

btnHallBack.setBackground(new java.awt.Color(255, 255, 255));


btnHallBack.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnHallBack.setText("Back");
btnHallBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHallBackActionPerformed(evt);
}
});

cmbHallLocation.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbHallLocation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "none", "Science Building",
"Pharmacy Building", "Nursing Building", "Admin Building", " " }));
cmbHallLocation.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
cmbHallLocationFocusLost(evt);
}
});

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());

64
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 96,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(52, 52, 52)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(cmbHallName, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtSeatNum, javax.swing.GroupLayout.PREFERRED_SIZE, 86,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbDepartment, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmbHallLocation, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmbAvailability, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmbHallUsage, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmbHallID, javax.swing.GroupLayout.PREFERRED_SIZE, 133,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(btnHallBack, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnHallAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 90,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(btnHallNext, javax.swing.GroupLayout.PREFERRED_SIZE, 88,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(HallCapacityLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 100,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(HallCapacity, javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(257, 257, 257))))
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
.addGap(46, 46, 46)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()

65
.addGap(3, 3, 3)
.addComponent(cmbHallName, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbHallLocation, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 38, Short.MAX_VALUE)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(HallCapacity, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(HallCapacityLabel)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtSeatNum, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jInternalFrame1Layout.createSequentialGroup()
.addGap(31, 31, 31)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(cmbAvailability, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)))
.addGap(18, 18, 18)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(cmbDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)))
.addGap(24, 24, 24)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbHallID, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(19, 19, 19)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbHallUsage, javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(185, 185, 185)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnHallAdd)
.addComponent(btnHallNext)
.addComponent(btnHallBack))
.addContainerGap(52, Short.MAX_VALUE))))

66
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jInternalFrame1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jInternalFrame1)
.addGap(48, 48, 48))
);
getAccessibleContext().setAccessibleParent(this);
pack();
}// </editor-fold>

private void btnHallBackActionPerformed(java.awt.event.ActionEvent evt) {


cmbHallName.setSelectedIndex(-1);
cmbHallLocation.setSelectedIndex(-1);
txtSeatNum.setText("");
cmbAvailability.setSelectedIndex(-1);
cmbDepartment.setSelectedIndex(-1);
cmbHallID.setSelectedIndex(-1);
cmbHallUsage.setSelectedIndex(-1);
School.AcademicSession = "";
School.InstitutionLocation = "";
School.NumOfFaculties = School.Zero;
School.NumOfCourses = School.Zero;
School.ExamDays = "";
exit();
School.setVisible(true);
}

private void btnHallAddActionPerformed(java.awt.event.ActionEvent evt) {


btnHallNext.setEnabled(false);
int HallEntry = 0;
do {
// value entering into variables ; mostly assignment and control statements.
for (HallCount = 0; HallCount < 15; HallCount++) {
// try {
HallName[HallCount] = HallNameCopy;
HallLocation[HallCount] = HallLocationCopy;
NumOfSeats[HallCount] = NumOfSeatsCopy;
if ((NumOfSeats[HallCount] > 0) && (NumOfSeats[HallCount] <= 50)) {
NumOfSeatsStat[HallCount] = 1;
} else if ((NumOfSeats[HallCount] > 50) && (NumOfSeats[HallCount] <= 100)) {
NumOfSeatsStat[HallCount] = 2;
} else if ((NumOfSeats[HallCount] > 100) && (NumOfSeats[HallCount] <= 150)) {
NumOfSeatsStat[HallCount] = 3;
} else if ((NumOfSeats[HallCount] > 150) && (NumOfSeats[HallCount] <= 200)) {
NumOfSeatsStat[HallCount] = 4;
} else if ((NumOfSeats[HallCount] > 200) && (NumOfSeats[HallCount] <= 300)) {
NumOfSeatsStat[HallCount] = 5;
} else if ((NumOfSeats[HallCount] > 300) && (NumOfSeats[HallCount] <= 400)) {
NumOfSeatsStat[HallCount] = 6;
} else {
NumOfSeatsStat[HallCount] = 7;

67
}
if (cmbAvailability.getSelectedIndex() == 0) {
HallAvailability[HallCount] = 1;
} else if (cmbAvailability.getSelectedIndex() == 1) {
HallAvailability[HallCount] = 2;
} else if (cmbAvailability.getSelectedIndex() == 2) {
HallAvailability[HallCount] = 3;
} else {
HallAvailability[HallCount] = 4;
}
HallDept[HallCount] = (String) cmbDepartment.getSelectedItem();
HallID[HallCount] = cmbHallID.getSelectedIndex();
UsageOfHall[HallCount] = cmbHallUsage.getSelectedIndex();
// } catch (Exception e) {
// }
//check
// if (HallName[HallCount].equals(HallName[HallCount - 1]) ) {
// lblHallNameCheck.setText("Please no repeated values");
// }
cmbHallName.setSelectedIndex(-1);
cmbHallLocation.setSelectedIndex(-1);
txtSeatNum.setText("");
cmbAvailability.setSelectedIndex(-1);
cmbDepartment.setSelectedIndex(-1);
cmbHallID.setSelectedIndex(-1);
cmbHallUsage.setSelectedIndex(-1);
HallCapacityLabel.setText("");
HallCapacity.setText("");
}
HallEntry++;
} while (HallEntry < 15);
btnHallAdd.setEnabled(false);
btnHallNext.setEnabled(true);
}

private void btnHallNextActionPerformed(java.awt.event.ActionEvent evt) {


int Reply = JOptionPane.showConfirmDialog(null, "SUre to move to next stage?");
{
if (Reply == 0) {
exit();
CourseUI Course = new CourseUI();
Course.setVisible(true);
} else if (Reply == 1) {
this.setVisible(true);
} else {
btnHallAdd.setEnabled(true);
cmbHallName.setSelectedIndex(-1);
cmbHallLocation.setSelectedIndex(-1);
txtSeatNum.setText("");
cmbAvailability.setSelectedIndex(-1);
cmbDepartment.setSelectedIndex(-1);
cmbHallID.setSelectedIndex(-1);
cmbHallUsage.setSelectedIndex(-1);
}
}
}

private void cmbHallNameFocusLost(java.awt.event.FocusEvent evt) {


HallNameCopy = cmbHallName.getSelectedItem().toString();
if (cmbHallName.getSelectedIndex() == 0 || cmbHallName.getSelectedIndex() == -1) {
}
//else

68
// if (HallName[HallCount].equals(HallName[HallCount - 1]) )
//lblHallNameCheck.setText("Please no repeated values");
}
private void cmbHallIDFocusLost(java.awt.event.FocusEvent evt) {
if (cmbHallID.getSelectedIndex() == -1 || cmbHallID.getSelectedIndex() == 0) {
JOptionPane.showMessageDialog(null, "Please pick a value for hall ID", "hall ID null",
JOptionPane.ERROR_MESSAGE);
}
//else if ((HallID[HallCount - 1]) == HallID[HallCount] ) {
// JOptionPane.showMessageDialog(null, "Please pick a value for hall ID", "hall ID repeated",
JOptionPane.ERROR_MESSAGE);
// }
// lblHallNameCheck.setText("Please no repeated values");
}

private void txtSeatNumFocusLost(java.awt.event.FocusEvent evt) {


NumOfSeatsCopy = Integer.parseInt(txtSeatNum.getText());
HallCapacity1 = 3 * NumOfSeatsCopy;
String HallCapacityText = String.valueOf(HallCapacity1);
HallCapacityLabel.setText("Hall Capacity is:");
HallCapacity.setText(HallCapacityText);
}

private void cmbHallLocationFocusLost(java.awt.event.FocusEvent evt) {


HallLocationCopy = cmbHallLocation.getSelectedItem().toString();
}

public static void main(String args[]) {


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HallUI().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JLabel HallCapacity;
private javax.swing.JLabel HallCapacityLabel;
public javax.swing.JButton btnHallAdd;
private javax.swing.JButton btnHallBack;
private javax.swing.JButton btnHallNext;
private javax.swing.JComboBox cmbAvailability;
private javax.swing.JComboBox cmbDepartment;
private javax.swing.JComboBox cmbHallID;
public javax.swing.JComboBox cmbHallLocation;
public javax.swing.JComboBox cmbHallName;
private javax.swing.JComboBox cmbHallUsage;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
public javax.swing.JTextField txtSeatNum;
// End of variables declaration

private void exit() {


WindowEvent CloseWindow = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(CloseWindow);

69
}
}

CourseUI Codes:
package ExamTimetabler;
import java.awt.Toolkit;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
* @author Oroke Kenneth Augustine
*/
public class CourseUI extends javax.swing.JFrame {
HallUI Hall;
int CourseNum, FacultyNum, HallNum, DeptNum, HallCount, LoopControl, rows, cols, CourseNum1;
DefaultTableModel model;
ArrayList<String> PredegreeDept = new ArrayList();
String[][] Saturdays = new String[12][6];
int[][] SaturdaysAllocated = new int[12][6];
int[][] FridaysAllocated = new int[12][6];
String[][] Fridays = new String[12][6];
int[][] ThursdaysAllocated = new int[12][6];
String[][] Thursdays = new String[12][6];
int[][] WednesdaysAllocated = new int[12][6];
String[][] Wednesdays = new String[12][6];
int[][] TuesdaysAllocated = new int[12][6];
String[][] Tuesdays = new String[12][6];
int[][] MondaysAllocated = new int[12][6];
String[][] Mondays = new String[12][6];
ArrayList NoneDept = new ArrayList();
ArrayList None = new ArrayList();
ArrayList Predegree = new ArrayList();
ArrayList FirstYearsDept = new ArrayList();
ArrayList FirstYears = new ArrayList();
ArrayList SecondYearsDept = new ArrayList();
ArrayList SecondYears = new ArrayList();
ArrayList ThirdYearsDept = new ArrayList();
ArrayList ThirdYears = new ArrayList();
ArrayList FinalYearsDept = new ArrayList();
ArrayList FinalYears = new ArrayList();
int[][] StudNumSum = new int[68][6];
String[] FinalSlot = new String[68];
int CourseCounter = 0;
int[] NumOfStudStat = new int[CourseNum1];
String[] ConflictMatrix = new String[CourseNum1];
int[] TypeOfCourse = new int[CourseNum1];
int[] LevelOfCourse = new int[CourseNum1];
int[] DurationOfCourse = new int[CourseNum1];
int[] CourseStudNumStat = new int[CourseNum1];
int[] CourseStudNum = new int[CourseNum1];
String[] CourseDept = new String[CourseNum1];
String[] CourseFaculty = new String[CourseNum1];
String[] CourseLecturer = new String[CourseNum1];
String[] CourseCode = new String[CourseNum1];
String[] CourseTitle = new String[CourseNum1];
int[] StudNumSumMondays = new int[12];
int[] StudNumSumTuesdays = new int[12];
int[] StudNumSumFri = new int[12];
int[] StudNumSumSat = new int[12];

70
int[] StudNumSumThur = new int[12];
int[] StudNumSumWed = new int[12];

public CourseUI() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jPanel1 = new javax.swing.JPanel();


lblCourseTitle = new javax.swing.JLabel();
lblCourseCode = new javax.swing.JLabel();
lblCourseLecturer = new javax.swing.JLabel();
lblFaculty = new javax.swing.JLabel();
lblDepartment = new javax.swing.JLabel();
lblNumOfStud = new javax.swing.JLabel();
lblExamDuration = new javax.swing.JLabel();
txtCourseCode = new javax.swing.JTextField();
txtCourseLecturer = new javax.swing.JTextField();
cmbCourseFaculty = new javax.swing.JComboBox();
cmbCourseDepartment = new javax.swing.JComboBox();
txtNumberOfStud = new javax.swing.JTextField();
cmbExamDuration = new javax.swing.JComboBox();
lblCourseLevel = new javax.swing.JLabel();
lblCourseType = new javax.swing.JLabel();
cmbCourseLevel = new javax.swing.JComboBox();
cmbCourseType = new javax.swing.JComboBox();
btnCourseBack = new javax.swing.JButton();
btnCourseAdd = new javax.swing.JButton();
btnCourseNext = new javax.swing.JButton();
txtCourseNum1 = new javax.swing.JTextField();
lblCourseCode1 = new javax.swing.JLabel();
txtCourseTitle = new javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Course Information:");

jPanel1.setBorder(javax.swing.BorderFactory.createCompoundBorder());
jPanel1.setForeground(new java.awt.Color(255, 255, 255));

lblCourseTitle.setBackground(new java.awt.Color(255, 255, 255));


lblCourseTitle.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblCourseTitle.setForeground(new java.awt.Color(102, 0, 102));
lblCourseTitle.setText("Course Title:");

lblCourseCode.setBackground(new java.awt.Color(255, 255, 255));


lblCourseCode.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblCourseCode.setForeground(new java.awt.Color(102, 0, 102));
lblCourseCode.setText("Course Code:");

lblCourseLecturer.setBackground(new java.awt.Color(255, 255, 255));


lblCourseLecturer.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblCourseLecturer.setForeground(new java.awt.Color(102, 0, 102));
lblCourseLecturer.setText("Course Lecturer:");

lblFaculty.setBackground(new java.awt.Color(255, 255, 255));


lblFaculty.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblFaculty.setForeground(new java.awt.Color(102, 0, 102));
lblFaculty.setText("Faculty:");

lblDepartment.setBackground(new java.awt.Color(255, 255, 255));

71
lblDepartment.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblDepartment.setForeground(new java.awt.Color(102, 0, 102));
lblDepartment.setText("Department:");

lblNumOfStud.setBackground(new java.awt.Color(255, 255, 255));


lblNumOfStud.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblNumOfStud.setForeground(new java.awt.Color(102, 0, 102));
lblNumOfStud.setText("Number of students:");

lblExamDuration.setBackground(new java.awt.Color(255, 255, 255));


lblExamDuration.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblExamDuration.setForeground(new java.awt.Color(102, 0, 102));
lblExamDuration.setText("Duration of Exam:");

txtCourseCode.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


txtCourseCode.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtCourseCodeFocusLost(evt);
}
});
txtCourseCode.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtCourseCodeMouseClicked(evt);
}
});

txtCourseLecturer.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


txtCourseLecturer.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtCourseLecturerFocusLost(evt);
}
});

cmbCourseFaculty.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbCourseFaculty.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sciences", "Health
Sciences", "Basic Medical Sciences", "Pharmacy", "College of Medicine", "Engineering", "Arts", "Social Sciences" }));

cmbCourseDepartment.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbCourseDepartment.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Anatomy",
"Biochemistry", "Computer Science", "Industrial Chemistry", "Microbiology", "Medicine and Surgery", "MLS",
"Nursing Science", "Public Health", "Pharmacy", "Physiology", "Engineering" }));

txtNumberOfStud.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


txtNumberOfStud.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtNumberOfStudFocusLost(evt);
}
});
txtNumberOfStud.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtNumberOfStudMouseClicked(evt);
}
});

cmbExamDuration.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbExamDuration.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "3hrs", "2hrs",
"1hr:30mins", "1hr" }));

lblCourseLevel.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


lblCourseLevel.setForeground(new java.awt.Color(102, 0, 102));
lblCourseLevel.setText("Course Level:");

72
lblCourseType.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblCourseType.setForeground(new java.awt.Color(102, 0, 102));
lblCourseType.setText("Course Type:");
cmbCourseLevel.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
cmbCourseLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pre-Degree", "100", "200",
"300", "400", "500", "600" }));

cmbCourseType.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


cmbCourseType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Theoretical", "Practical",
"Both" }));

btnCourseBack.setBackground(new java.awt.Color(255, 255, 255));


btnCourseBack.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnCourseBack.setText("Back");
btnCourseBack.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCourseBackActionPerformed(evt);
}
});

btnCourseAdd.setBackground(new java.awt.Color(255, 255, 255));


btnCourseAdd.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnCourseAdd.setText("Add");
btnCourseAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCourseAddActionPerformed(evt);
}
});

btnCourseNext.setBackground(new java.awt.Color(255, 255, 255));


btnCourseNext.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
btnCourseNext.setText("Next");
btnCourseNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCourseNextActionPerformed(evt);
}
});

txtCourseNum1.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


txtCourseNum1.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtCourseNum1FocusLost(evt);
}
});
txtCourseNum1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
txtCourseNum1MouseClicked(evt);
}
});
txtCourseNum1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCourseNum1ActionPerformed(evt);
}
});

lblCourseCode1.setBackground(new java.awt.Color(255, 255, 255));


lblCourseCode1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
lblCourseCode1.setForeground(new java.awt.Color(102, 0, 102));
lblCourseCode1.setText("Number of Courses:");

txtCourseTitle.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {

73
txtCourseTitleFocusLost(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(411, 411, 411)
.addComponent(btnCourseBack, javax.swing.GroupLayout.PREFERRED_SIZE, 99,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnCourseAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 94,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCourseNext, javax.swing.GroupLayout.PREFERRED_SIZE, 94,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 753, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 185,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCourseCode, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCourseCode, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCourseLecturer, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCourseLecturer))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cmbCourseFaculty, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cmbCourseDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, 290,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblNumOfStud, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtNumberOfStud, javax.swing.GroupLayout.PREFERRED_SIZE, 99,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()

74
.addComponent(lblExamDuration, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cmbExamDuration, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblCourseLevel, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblCourseType, javax.swing.GroupLayout.PREFERRED_SIZE, 83,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(cmbCourseLevel, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(cmbCourseType, javax.swing.GroupLayout.PREFERRED_SIZE, 142,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCourseCode1, javax.swing.GroupLayout.PREFERRED_SIZE, 111,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txtCourseNum1, javax.swing.GroupLayout.PREFERRED_SIZE, 93,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCourseCode1, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCourseNum1, javax.swing.GroupLayout.PREFERRED_SIZE, 35,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCourseCode, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCourseCode, javax.swing.GroupLayout.PREFERRED_SIZE, 35,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(34, 34, 34)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtCourseLecturer)
.addComponent(lblCourseLecturer, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbCourseFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)

75
.addComponent(cmbCourseDepartment, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblNumOfStud, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNumberOfStud, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCourseLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbCourseLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblExamDuration, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbExamDuration, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblCourseType, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmbCourseType, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCourseBack, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnCourseAdd, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnCourseNext, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(73, 73, 73))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
getAccessibleContext().setAccessibleParent(this);
pack();
}// </editor-fold>
private void btnCourseBackActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
Hall.setVisible(true);
Hall.btnHallAdd.setEnabled(true);
}

private void btnCourseNextActionPerformed(java.awt.event.ActionEvent evt) {

76
//400 500 600
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Mondays, StudNumSum, MondaysAllocated,
StudNumSumMondays, FinalYearsStudNum);
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Tuesdays, StudNumSum, TuesdaysAllocated,
StudNumSumTuesdays, FinalYearsStudNum);
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Wednesdays, StudNumSum, WednesdaysAllocated,
StudNumSumWed, FinalYearsStudNum);
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Thursdays, StudNumSum, ThursdaysAllocated,
StudNumSumThur, FinalYearsStudNum);
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Fridays, StudNumSum, FridaysAllocated,
StudNumSumFri, FinalYearsStudNum);
timeSlotting(FinalYears, FinalYearsDept, LoopControl, Saturdays, StudNumSum, SaturdaysAllocated,
StudNumSumSat, FinalYearsStudNum);
//300 and 2000
timeSlotting3(ThirdYears, ThirdYearsDept, LoopControl, Mondays, StudNumSum, MondaysAllocated,
StudNumSumMondays, ThirdYearsStudNum);
timeSlotting3(SecondYears, SecondYearsDept, LoopControl, Tuesdays, StudNumSum, TuesdaysAllocated,
StudNumSumTuesdays, SecondYearsStudNum);
timeSlotting3(ThirdYears, ThirdYearsDept, LoopControl, Wednesdays, StudNumSum, WednesdaysAllocated,
StudNumSumWed, ThirdYearsStudNum);
timeSlotting3(SecondYears, SecondYearsDept, LoopControl, Thursdays, StudNumSum, ThursdaysAllocated,
StudNumSumThur, SecondYearsStudNum);
timeSlotting3(ThirdYears, ThirdYearsDept, LoopControl, Fridays, StudNumSum, FridaysAllocated,
StudNumSumFri, ThirdYearsStudNum);
timeSlotting3(SecondYears, SecondYearsDept, LoopControl, Saturdays, StudNumSum, SaturdaysAllocated,
StudNumSumSat, SecondYearsStudNum);
// 100 and PD
timeSlotting1(FirstYears, LoopControl, Mondays, StudNumSum, MondaysAllocated, StudNumSumMondays,
FirstYearsStudNum);
timeSlotting1(Predegree, LoopControl, Tuesdays, StudNumSum, TuesdaysAllocated, StudNumSumTuesdays,
PredegreeStudNum);
timeSlotting1(FirstYears, LoopControl, Wednesdays, StudNumSum, WednesdaysAllocated, StudNumSumWed,
FirstYearsStudNum);
timeSlotting1(FirstYears, LoopControl, Thursdays, StudNumSum, ThursdaysAllocated, StudNumSumThur,
FirstYearsStudNum);
timeSlotting1(Predegree, LoopControl, Fridays, StudNumSum, FridaysAllocated, StudNumSumFri,
PredegreeStudNum);
//anonimous
timeSlottingAnonimous4(None, NoneDept, LoopControl, Mondays, StudNumSum, MondaysAllocated,
StudNumSumMondays, NoneStudNum);
timeSlottingAnonimous4(None, NoneDept, LoopControl, Tuesdays, StudNumSum, TuesdaysAllocated,
StudNumSumTuesdays, NoneStudNum);
timeSlottingAnonimous4(None, NoneDept, LoopControl, Wednesdays, StudNumSum, WednesdaysAllocated,
StudNumSumWed, NoneStudNum);
timeSlottingAnonimous4(None, NoneDept, LoopControl, Thursdays, StudNumSum, ThursdaysAllocated,
StudNumSumThur, NoneStudNum);
timeSlottingAnonimous4(None, NoneDept, LoopControl, Fridays, StudNumSum, FridaysAllocated,
StudNumSumFri, NoneStudNum);
timeSlottingAnonimous4(None, NoneDept, LoopControl, Saturdays, StudNumSum, SaturdaysAllocated,
StudNumSumSat, NoneStudNum);
timeSlottingAnonimous32(ThirdYears, ThirdYearsDept, LoopControl, Mondays, StudNumSum,
MondaysAllocated, StudNumSumMondays, ThirdYearsStudNum);
timeSlottingAnonimous32(SecondYears, SecondYearsDept, LoopControl, Tuesdays, StudNumSum,
TuesdaysAllocated, StudNumSumTuesdays, SecondYearsStudNum);
timeSlottingAnonimous32(ThirdYears, ThirdYearsDept, LoopControl, Wednesdays, StudNumSum,
WednesdaysAllocated, StudNumSumWed, ThirdYearsStudNum);
timeSlottingAnonimous32(SecondYears, SecondYearsDept, LoopControl, Thursdays, StudNumSum,
ThursdaysAllocated, StudNumSumThur, SecondYearsStudNum);
timeSlottingAnonimous32(ThirdYears, ThirdYearsDept, LoopControl, Fridays, StudNumSum, FridaysAllocated,
StudNumSumFri, ThirdYearsStudNum);
timeSlottingAnonimous32(SecondYears, SecondYearsDept, LoopControl, Saturdays, StudNumSum,
SaturdaysAllocated, StudNumSumSat, SecondYearsStudNum);

77
timeSlottingAnonimous01(FirstYears, FirstYearsDept, LoopControl, Mondays, StudNumSum, MondaysAllocated,
StudNumSumMondays, FirstYearsStudNum);
timeSlottingAnonimous01(Predegree, PredegreeDept, LoopControl, Tuesdays, StudNumSum, TuesdaysAllocated,
StudNumSumTuesdays, PredegreeStudNum);
timeSlottingAnonimous01(FirstYears, FirstYearsDept, LoopControl, Wednesdays, StudNumSum,
WednesdaysAllocated, StudNumSumWed, FirstYearsStudNum);
timeSlottingAnonimous01(FirstYears, FirstYearsDept, LoopControl, Thursdays, StudNumSum,
ThursdaysAllocated, StudNumSumThur, FirstYearsStudNum);
timeSlottingAnonimous01(Predegree, FirstYearsDept, LoopControl, Fridays, StudNumSum, FridaysAllocated,
StudNumSumFri, PredegreeStudNum);
model = (DefaultTableModel) FinalTimetable.tblFinalTimetableA.getModel();
model.insertRow(rows, Mondays);
}
exit();
FinalTimetable FinalTime1 = new FinalTimetable();
FinalTime1.setVisible(true);
}

private void txtCourseCodeFocusLost(java.awt.event.FocusEvent evt) {


if (txtCourseCode.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Please enter course code", "Course code empty",
JOptionPane.ERROR_MESSAGE);
txtCourseCode.grabFocus();
}
}

private void txtCourseLecturerFocusLost(java.awt.event.FocusEvent evt) {


if (txtCourseLecturer.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Please enter name of lecturer taking the course", "Lecturer field empty",
JOptionPane.ERROR_MESSAGE);
txtCourseLecturer.grabFocus();
}
}

private void txtNumberOfStudFocusLost(java.awt.event.FocusEvent evt) {


if (txtNumberOfStud.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Please enter number of students taking the course", "Number of Student
Err", JOptionPane.ERROR_MESSAGE);
txtNumberOfStud.grabFocus();
}
}

private void btnCourseAddActionPerformed(java.awt.event.ActionEvent evt) {


for (CourseCounter = 0; CourseCounter < CourseCode.length; CourseCounter++) {
CourseTitle[CourseCounter] = txtCourseTitle.getText();
CourseCode[CourseCounter] = txtCourseCode.getText();
CourseLecturer[CourseCounter] = txtCourseLecturer.getText();
CourseFaculty[CourseCounter] = cmbCourseFaculty.getSelectedItem().toString();
CourseDept[CourseCounter] = cmbCourseDepartment.getSelectedItem().toString();
CourseStudNum[CourseCounter] = Integer.parseInt(txtNumberOfStud.getText());
{
if ((CourseStudNum[CourseCounter]) <= 50) {
CourseStudNumStat[CourseCounter] = 1;
} else if ((CourseStudNum[CourseCounter] > 50) && (CourseStudNum[CourseCounter] < 100)) {
CourseStudNumStat[CourseCounter] = 2;
} else if ((CourseStudNum[CourseCounter] > 100) && (CourseStudNum[CourseCounter] <= 150)) {
CourseStudNumStat[CourseCounter] = 3;
} else if ((CourseStudNum[CourseCounter] > 150) && (CourseStudNum[CourseCounter] <= 200)) {
CourseStudNumStat[CourseCounter] = 4;
} else if ((CourseStudNum[CourseCounter] > 200) && (CourseStudNum[CourseCounter] <= 300)) {
CourseStudNumStat[CourseCounter] = 5;
} else if ((CourseStudNum[CourseCounter] > 300) && (CourseStudNum[CourseCounter] <= 400)) {

78
CourseStudNumStat[CourseCounter] = 6;
} else if ((CourseStudNum[CourseCounter] > 400) && (CourseStudNum[CourseCounter] <= 500)) {
CourseStudNumStat[CourseCounter] = 7;
} else {
CourseStudNumStat[CourseCounter] = 8;
}
} // end if-statements for CourseStudNum[]
String Duration = cmbExamDuration.getSelectedItem().toString();
switch (Duration) {
case "3hrs":
DurationOfCourse[CourseCounter] = 1;
break;
case "2hrs":
DurationOfCourse[CourseCounter] = 2;
break;
case "1hr:30mins":
DurationOfCourse[CourseCounter] = 3;
break;
default:
DurationOfCourse[CourseCounter] = 4;
break;
} // end switch
String Level = (String) cmbCourseType.getSelectedItem();
switch (Level) {
case "Pre-Degree":
LevelOfCourse[CourseCounter] = 0;
break;
case "100":
LevelOfCourse[CourseCounter] = 1;
break;
case "200":
LevelOfCourse[CourseCounter] = 2;
break;
case "300":
LevelOfCourse[CourseCounter] = 3;
break;
case "400":
LevelOfCourse[CourseCounter] = 4;
break;
case "500":
LevelOfCourse[CourseCounter] = 5;
break;
default:
LevelOfCourse[CourseCounter] = 6;
break;
} // end switc control flow
String Type = cmbCourseType.getSelectedItem().toString();
switch (Type) {
case "Theory":
TypeOfCourse[CourseCounter] = 1;
break;
case "Practical":
TypeOfCourse[CourseCounter] = 2;
break;
default:
TypeOfCourse[CourseCounter] = 3;
break;
} // end switch for Course type
//grouping of courses
switch (LevelOfCourse[CourseCounter]) {
case 4:
FinalYears.add(CourseCode[CourseCounter]);

79
FinalYearsDept.add(CourseDept[CourseCounter]);
FinalYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 5:
FinalYears.add(CourseCode[CourseCounter]);
FinalYearsDept.add(CourseDept[CourseCounter]);
FinalYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 6:
FinalYears.add(CourseCode[CourseCounter]);
FinalYearsDept.add(CourseDept[CourseCounter]);
FinalYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 3:
ThirdYears.add(CourseCode[CourseCounter]);
ThirdYearsDept.add(CourseDept[CourseCounter]);
ThirdYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 2:
SecondYears.add(CourseCode[CourseCounter]);
SecondYearsDept.add(CourseDept[CourseCounter]);
SecondYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 1:
FirstYears.add(CourseCode[CourseCounter]);
FirstYearsDept.add(CourseCode[CourseCounter]);
FirstYearsStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
case 0:
Predegree.add(CourseCode[CourseCounter]);
PredegreeStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
default:
None.add(CourseCode[CourseCounter]);
NoneDept.add(CourseDept[CourseCounter]);
NoneStudNum[CourseCounter] = CourseStudNum[CourseNum];
break;
}
txtCourseTitle.setText("");
txtCourseCode.setText("");
txtCourseLecturer.setText("");
cmbCourseFaculty.setSelectedIndex(-1);
cmbCourseDepartment.setSelectedIndex(-1);
txtNumberOfStud.setText("");
cmbExamDuration.setSelectedIndex(-1);
cmbCourseLevel.setSelectedIndex(-1);
cmbCourseType.setSelectedIndex(-1);
}
}

private void txtCourseNum1FocusLost(java.awt.event.FocusEvent evt) {


CourseNum1 = Integer.parseInt(txtCourseNum1.getText());
txtCourseNum1.setEnabled(false);
}
private void txtCourseNum1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}

private void txtCourseTitleFocusLost(java.awt.event.FocusEvent evt) {


if (txtCourseTitle.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Please input course title", "Course tiltle empty",
JOptionPane.ERROR_MESSAGE);

80
} else {
}
}

public static void main(String args[]) {


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CourseUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnCourseAdd;
private javax.swing.JButton btnCourseBack;
private javax.swing.JButton btnCourseNext;
private javax.swing.JComboBox cmbCourseDepartment;
private javax.swing.JComboBox cmbCourseFaculty;
private javax.swing.JComboBox cmbCourseLevel;
private javax.swing.JComboBox cmbCourseType;
private javax.swing.JComboBox cmbExamDuration;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblCourseCode;
private javax.swing.JLabel lblCourseCode1;
private javax.swing.JLabel lblCourseLecturer;
private javax.swing.JLabel lblCourseLevel;
private javax.swing.JLabel lblCourseTitle;
private javax.swing.JLabel lblCourseType;
private javax.swing.JLabel lblDepartment;
private javax.swing.JLabel lblExamDuration;
private javax.swing.JLabel lblFaculty;
private javax.swing.JLabel lblNumOfStud;
private javax.swing.JTextField txtCourseCode;
private javax.swing.JTextField txtCourseLecturer;
private javax.swing.JTextField txtCourseNum1;
private javax.swing.JTextField txtCourseTitle;
private javax.swing.JTextField txtNumberOfStud;
// End of variables declaration
int[] NoneStudNum = new int[FinalYears.size()];
int[] PredegreeStudNum = new int[FinalYears.size()];
int[] FirstYearsStudNum = new int[FinalYears.size()];
int[] SecondYearsStudNum = new int[FinalYears.size()];
int[] ThirdYearsStudNum = new int[FinalYears.size()];
int[] FinalYearsStudNum = new int[FinalYears.size()];
private void exit() {
WindowEvent CloseWindow = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(CloseWindow);
}
/**
* inputs the method can carry
*
* @param Level
* @param LevelDept
* @param Counter
* @param Days
* @param NumOfStudents
* @param Allocation
* @param SlotStudNum
* @param LevelStudNum
*/
public void timeSlotting(ArrayList<String> Level, ArrayList<String> LevelDept, int Counter, String[][] Days, int[][]
NumOfStudents, int[][] Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {

81
Level.get(Counter);
LevelDept.get(Counter);
for (rows = 0; rows <= 9; rows += 3) {
for (cols = 0; cols < 6; cols++) {
if (LevelDept.get(Counter - 1).equals(LevelDept.get(Counter))) {
rows = (rows + 3);
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
{
if (Days[rows][cols].isEmpty()) {
Allocation[rows][cols] = 0;
} else {
Allocation[rows][cols] = 1;
}
}
} else {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[LoopControl];
{
if (Days[rows][cols].isEmpty()) {
Allocation[rows][cols] = 0;
} else {
Allocation[rows][cols] = 1;
}
}
}
switch (rows) {
case 0:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 3:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 6:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 9:
SlotStudNum[rows] += NumOfStudents[rows][cols];
default:
break;
}
} //coloumn
} // row
}
}

public void timeSlotting3(ArrayList<String> Level, ArrayList<String> LevelDept, int Counter, String[][] Days, int[][]
NumOfStudents, int[][] Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {
Level.get(Counter);
LevelDept.get(Counter);
for (rows = 1; rows <= 10; rows += 3) {
for (cols = 0; cols < 6; cols++) {
if (LevelDept.get(Counter - 1).equals(LevelDept.get(Counter))) {
rows = (rows + 3);
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
{
if (Days[rows][cols].isEmpty()) {
Allocation[rows][cols] = 0;
} else {
Allocation[rows][cols] = 1;

82
}
}
} else {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[LoopControl];
{
if (Days[rows][cols].isEmpty()) {
Allocation[rows][cols] = 0;
} else {
Allocation[rows][cols] = 1;
}
}
}
switch (rows) {
case 1:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 4:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 7:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 10:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
default:
break;
}
} //coloumn
} // row
}
}

public void timeSlotting1(ArrayList<String> Level, int Counter, String[][] Days, int[][] NumOfStudents, int[][]
Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {
Level.get(Counter);
for (rows = 2; rows <= 11; rows += 3) {
for (cols = 0; cols < 6; cols += 5) {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
if (Days[rows][cols].isEmpty()) {
Allocation[rows][cols] = 0;
} else {
Allocation[rows][cols] = 1;
}
switch (rows) {
case 2:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 5:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 8:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 11:
SlotStudNum[rows] += NumOfStudents[rows][cols];
default:
break;
}

83
} //coloumn
} // row
}
}

public void timeSlottingAnonimous4(ArrayList<String> Level, ArrayList<String> LevelDept, int Counter, String[][]


Days, int[][] NumOfStudents, int[][] Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {
Level.get(Counter);
LevelDept.get(Counter);
for (rows = 0; rows <= 9; rows += 3) {
for (cols = 0; cols < 6; cols++) {
if (Allocation[rows][cols] == 0) {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
}
switch (rows) {
case 0:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 3:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 6:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 9:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
default:
break;
}
} //coloumn
} // row
}
}

public void timeSlottingAnonimous32(ArrayList<String> Level, ArrayList<String> LevelDept, int Counter, String[][]


Days, int[][] NumOfStudents, int[][] Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {
Level.get(Counter);
LevelDept.get(Counter);
for (rows = 1; rows <= 10; rows += 3) {
for (cols = 0; cols < 6; cols++) {
if (Allocation[rows][cols] == 0) {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
}
switch (rows) {
case 1:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 4:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 7:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 10:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
default:

84
}
} //coloumn
} // row
}
}
public void timeSlottingAnonimous01(ArrayList<String> Level, ArrayList<String> LevelDept, int Counter, String[][]
Days, int[][] NumOfStudents, int[][] Allocation, int[] SlotStudNum, int[] LevelStudNum) {
for (Counter = 0; Counter < Level.size(); Counter++) {
Level.get(Counter);
LevelDept.get(Counter);
for (rows = 2; rows <= 11; rows += 3) {
for (cols = 0; cols < 6; cols++) {
if (Allocation[rows][cols] == 0) {
Days[rows][cols] = Level.get(Counter);
NumOfStudents[rows][cols] = LevelStudNum[Counter];
}
switch (rows) {
case 2:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 5:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 8:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
case 11:
SlotStudNum[rows] += NumOfStudents[rows][cols];
break;
default:
} } //coloumn
} // row }
} }

85

You might also like