attendance using wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf ·...

57
i Attendance Using Wireless Submitted by Mohammed Abdulhameed Kutbi 0857658 Faculty of Computing and Information Technology King Abdul Aziz University Jeddah – Saudi Arabia 8/1432 – 7/2011

Upload: vannhu

Post on 14-Mar-2018

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

i

Attendance Using Wireless

Submitted by Mohammed Abdulhameed Kutbi

0857658

Faculty of Computing and Information Technology King Abdul Aziz University

Jeddah – Saudi Arabia 8/1432 – 7/2011

Page 2: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

ii

بسم هللا االرحمن االرحيیم

Page 3: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

iii

شهھد هللا أأنهھ ال إإلهھ إإال هھھھو وواالمالئكة ﴿ :قولهھ عز ووجل)18آآلل عمراانن: ( ﴾ووأأوولو االعلم قائما بالقسط

يیرفع هللا االذيین آآمنواا منكم وواالذيین ﴿ :ووقالل هللا تعالى )11االمجاددلة: ( ﴾أأووتواا االعلم ددررجاتت

صلى منن حدديیثث أأبي هھھھرريیررةة ررضي هللا عنهھ أأنن االررسوولللتمس فيیهھ علماً "قالل: هللا عليیهھ ووسلمم ططريیقاً يی من سلك

االجنة ً إإلى قا ّل لهھ بهھ ططريی ". سهھ

عن أأبي هھھھريیرةة ررضي هللا عنهھ قالل قالل صلى هللا عليیهھ إإذذاا ماتت اابن ااددمم اانقطع عملهھ إإال من ثالثث إإال من "ووسلم

"صدقة جارريیهھ أأوو علم يینتفع بهھ أأوو وولد صالح يیدعواا لهھ

Certification of Research

Page 4: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

iv

I certify that I have reviewed this project done by: Mohammed Abdulhameed Kutbi 0857658 during the 2nd semester of the academic year 1431-1432/2010-2011. And I approve the project submission for discussion by the project responsible committee to grade it as the graduation project degree in IT Department.

Supervisor: Mr. Akbar Badhusha Signature:

Page 5: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

v

Declaration

I certify that the implementation of this graduation project has been done by my own efforts. This includes the preparation and writing of the analysis, design, programming and documentation. I have got assistance during the implementation period of this project, after Allah, from the references mentioned in this thesis, and Allah is the witnesses of what we say.

Student Name: Mohammed Abdulhameed Kutbi Student ID: 0857658 E-mail: [email protected]. Mobile: 05566155221 Signature:

Page 6: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

vi

Attendance Using Wireless

Abstract

This project is a wireless attendance system. It works for taking students` attendance at university. The university has a several ways to take the attendance. The goal of this project is to design and develop a fully functional automated class attendance register system, including hardware, firmware, and application software. The project based on Wifi technology and basic research of WiFi equipment was conducted. It was shown that an effective attendance register system can be implemented with the help of new and emerging technologies. Most of Manually way of taking attendance has a disadvantage which is wastage of time. The attendance using wireless is improving the way of getting attendance to avoid ‘waste of time’ problem. So, it`s a time saving solution and with the help of new and emerging technologies. The attendance using wireless system can be done in these four main steps. The first step is, configure router with students` mobiles to get their attendance. The second step is, sending attendance`s information from the router to the server. The third step will be in the server side which is filtering received addresses and ensure that student is inside the required area and record them in the database. The last step is, making the lecturers able to connect with server and query about their sections` tables.

Page 7: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

vii

Dedicated to

This project is dedicated to my mother, my father and the whole family for their continued support, motivation and understanding throughout the period of my studies. Without them I wouldn’t have made it.

Page 8: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

viii

Acknowledgement

The preparation of this important document would not have been possible without the support, hard work and endless efforts of a large number of individuals and institutions. I would like to take this opportunity to thank all my lecturers who have directly or indirectly helped in my project. I pay my respect and love to my parents, all other family members, friends for their love and encouragement throughout my career. Last but not the least I express my thanks to my brothers Jad, Rayan and Majed for their cooperation and support.

Page 9: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

ix

Table of Contents: Certiification of Research ....................................................................................... iii Declarcation ............................................................................................................ iv Abstract .................................................................................................................... v Dedicated to ............................................................................................................ vi Acknowledgments ................................................................................................. vii Table of Content ................................................................................................... viii List Of Figure ......................................................................................................... ix List Of Table ........................................................................................................... ix

Chapter 1: Project Specification ............................................................................. 1 1.1. Introduction ................................................................................................... 2 1.2. Problem definition ......................................................................................... 2 1.3. Aim ................................................................................................................ 2 1.4. Objectives ...................................................................................................... 2 1.5. Methodology .................................................................................................. 2 1.6. Project plan .................................................................................................... 2

Chapter 2: Literature Review ................................................................................. 4 2.1. Literature Review .......................................................................................... 5

Chapter 3: Analysis ................................................................................................ 7 3.1. Data collection ............................................................................................... 8 3.2. Requirements: ................................................................................................ 8

3.2.1 Functional requirements ......................................................................... 8 3.2.2 Non-functional requirements ................................................................. 8 3.2.3 Performance requirements ...................................................................... 8

3.3. User profile .................................................................................................... 9 3.3.1 User categories ........................................................................................ 9 3.3.2 Sample specification ............................................................................... 9 3.3.3 User characteristics ............................................................................... 9 3.3.4 Environment ............................................................................................ 9

3.4. Structuring System Requirement .................................................................. 9 3.4.1 Use case model ....................................................................................... 9 3.4.2 Data flow diagram/ class diagram representing domain model ............ 10

Chapter 4: System Design .................................................................................... 11 4.1. System Architecture .................................................................................... 12 4.2. Database design ........................................................................................... 12

Page 10: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

x

4.3. Structure Design ......................................................................................... 13 4.4. User interface design ................................................................................... 14

Chapter 5: Implementation ................................................................................... 16 5.1.Tools ............................................................................................................. 17 5.2.Interface Description .................................................................................... 17 5.3 System Processes in background Description .............................................. 18

Chapter 6: Usability Testing ................................................................................ 19 6.1.Methods used in usability testing ................................................................. 20 6.2.Test design .................................................................................................... 20 6.3.Conducting the test ....................................................................................... 21 6.4. Results ......................................................................................................... 22

Chapter 7: Conclusion .......................................................................................... 23 7.1.Problems and difficulties .............................................................................. 24 7.2.findings ......................................................................................................... 24 7.3.Recommendations ........................................................................................ 24 7.4.Future work .................................................................................................. 24 7.5.Conclusion .................................................................................................... 24

List of References ................................................................................................. 25 Appendix ( Complete code ) ................................................................................ 27

Page 11: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

xi

List of Figures Chapter 1

1.6 Project Plan……………………………………………………….........3

Chapter 3 3.4.1 UseCase…………………………………………………………….…9 3.4.2 Data Flow Daigram………………………………………………….10

Chapter 4

4.1 System Architucure…………………………………………………12 4.2 Databse Desgin………………………………………………………12 4.3 Class Diagram Server-Side………………………………………….13 4.3 Class Diagram Client-Side………………………………………….13 4.4.1 Login interface…………………………………………………….14 4.4.2 SectionView interface……………………………………………..14 4.4.3 SectionTable……………………………………………………….15

List of Tables Chapter 6

6.3.1 Connect user with wireless router………………………………...21 6.3.2 recording attendance in database…………………………………21 6.3.3 view to user sections` tables which user owned…………………..21 6.3.4 Login Page…………………………………………………………..22

Page 12: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

1

Chapter 1

Introduction

Page 13: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

2

Chapter 1: Project Specification

1.1 Introduction Attendance at the university is important to increase students’ performance. Therefore, most of the universities specialty some of the evolution marks for the attendance to stimulate students to attend. So, there are many ways being used to take the attendance such as calling names one student at the time or circulate the attendance sheet to students to record their attendance. However, all these ways of taking attendance are wastage of time. This project is finding out the way for taking attendance and avoiding wastage time disadvantage.

1.2 Problem definition The problem is the 'wastage of time' disadvantage that being use to take the students attendance which is most of the universities use.

1.3 Aim The Aim of the project is finding out a new way of taking attendance by avoiding the 'wastage of time' disadvantage, which is most of the universities facing in their taking attendance systems.

1.4 Objectives Attendance using the wireless system will take the students attendance and record them in a Database automatically.

1.5 Methodology I used Waterfall methodology to implement the attendance by using Wireless System because it is very simple to use and understandable. In the waterfall model, each phase must be completed in its entirety before the next phase can begin.

1.6 Project plan Implementing this software time was separated into two periods each period has several phases :-

1) 1st Period: 1.1 Date was from 22/09/2010 to 24/01/2011 1.2 Phases are planning and analysis.

2) 2nd Period: 2.1 Date was from 12/02/2011 to 11/06/2011 2.2 Phases are design, implement, and testing.

Page 14: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

3

To implement this system software I used Microsoft Project application to plan before starting implement it. Figure 1.6, is showing the planning time table.

Figure 1.6 Project Plan

Page 15: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

4

Chapter 2

Literature Review

Page 16: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

5

Chapter 2: Literature Review

2.1 Literature Review There are many systems that similar to our system. Some of them, made for the same purpose and the others made for another purpose but using the same technology. [1] One of these systems is a system called SmartChecker. The SmartChecker`s job is, tracking the situation of the students by tracking their attendance. Technically SmartChecker`s job is, to access database using mobile phone. The point of this project is to look after the students and if any of students got out of the range (limit number of absents) teachers and administrators will take an action and give the student some attention immediately. The SmartChecker developer, choose to implement the SmartChecker appellation on the mobile device. In the SmartChecker, there must to be a database to record the students attendance and accessible by users SmartChecker`s system smaller to our system in using mobile and having a database for students` attendance. [2]There is another system which is similar to our system which called Attendance Management System. The goal of this system is, to recording students’ attendance by doing some statics information and making reports. Technically, this system application work on the computer to record students` attendance instead of papers. In the conclusion, the Attendance Management System is smaller to our system by having a database for the students’ attendance and improving students` attendance. [3]Third system is similar to our system which called Students Attendance System by using Fingerprint (SAS). The SAS job is, getting students` attendance by using fingerprint technology. Technically SAS`s job is, accessing the database using fingerprint device and record the students and the lecturer`s attendance. The point of SAS is saving resource of wastage, decrease the weight of resource, carry of taking them to class, and give exact results. In the SAS there must be a database for recording the students attendance and accessible by users. However, this system is smaller to our system because both are doing students attendance. In the conclusion, my system and SAS doing same job but the deferent is the technology used to do the job. [4] Fourth system called, Lecture Attendance System. The Lecture Attendance System job is getting the students` attendance by Face Recognition technology. Technically Lecture Attendance System`s job is receiving the image from Camera (set in class room) and depend on the image the system will record students` attendance. The point of Lecture Attendance System is saving students and lecturer`s time and give exact results. In the Lecture Attendance System there must be a database for recording the students attendance and accessible by users. This System smaller to our because both doing students` attendance in a improving way. In the conclusion, my system and Lecture Attendance System doing same job but deference is the technology used to do the job. [5] Fifth system called, Class Attendance Recording System. The Class Attendance Recording System `s job is getting students` attendance by using RFID and WiFi technology Technically Class Attendance Recording System `s job is receiving information contain students which attended the class from RFID device and depend on these information system record students` attendance. The point of Class Attendance Recording System is saving resources and giving exact

Page 17: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

6

results with the help of using new technologies. This System smaller to our system because both doing students` attendance in improving way. In the Conclusion my system and Class Attendance Recording System doing same job but deference is the technology used to do the job.

Page 18: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

7

Chapter 3

Analysis

Page 19: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

8

Chapter 3: Analysis

3.1 Data collection After finishing the search and collecting data about this topic I found out that there are some parts should I use to implement the project:

1) Using Java language to program the software because it`s support OO and java

program can run on a lot of OS ( windows OS , mac OS …etc). 2) Must have Database to record attendance and kind of database depends on

number of students and classes the university has. 3) Must have connection (LAN network) between server and wireless device and

between server and lecturers offices. 4) Must use a wireless device that have Mac address table.

3.2 Requirements:

3.2.1 Functional requirements Functional requirements are the goals of the project or something to achieved the goals. In my project there are several functional requirements. 1st requirement is ability of system to take students` attendance in specific time, specific location, and record them in database correctly. 2nd requirement is the ability of system to allow lecturer to connect with system and query about their sections.

3.2.2 Non-functional requirements

In this project there are several non-functional requirements. 1st requirement is making the system be able to connect with most kind of mobile devices (which student has). 2nd requirement make the system (client side) able to work with most of OS which the lecturers have.

3.2.3 Performance requirements

In this project there are several performance functional requirements. 1st requirement is system (client-side) must be available at all lecturers` computers which they want to connect with server by. 2nd requirement is system (server-side) must be online during the classes’ time and during the lecturer connection with server time.

Page 20: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

9

3.3 User profile

3.3.1 User categories v Students and Lecturers.

3.3.2 Sample specification v Students – will interact with system in the classroom and

interacting will be by connecting their mobiles with wireless router. v Lecturers – will interact with system when lecturer needs to query

about his/ her students attendance.

3.3.3 User characteristics

For our system there 2 king of user: v Student – Must know how to use the mobile phone to connect with

the system. v Lecturer – Must be good in English, able to read and known how

to use PC.

3.3.4 Environment v The environment for the students will be the classroom. v The environment for the lecturers will be anywhere that can

connect from it to university network.

3.4 Structuring System Requirement.

3.4.1 Use case model.

Figure 3.4.1 Use Case

Connect with router by mobile

Query about students` attendance

Lecturer Student

Login

Page 21: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

10

3.4.2 Data flow diagram/ class diagram representing domain model. Figure 3.4.2 shows the data flow diagram of Attendance using Wireless system and sequence of class in run time.

Figure 3.4.2 Data Flow Diagram

Main

FrameThread

frame

Table

ThreadRecord

DealingWithDB

ThreadDealWithClient

Main

Page 22: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

11

Chapter 4

System Design

Page 23: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

12

Chapter 4: System Design

4.1 System Architecture The system has four main parts. 1st part of system is configuring router with students` mobiles to get their attendance. 2nd part of system is sending attendance`s information from the router to server. 3rd part of system will be in the server side which is filtering received addresses and ensure that student is inside the required area and record them in the database. 4th and last part of system is make lecturers able to connect with server and query about their sections` tables. All these parts of system are shown in Figure 4.1 .

Figure 4.1 System Architecture

4.2 Database design The Figure below showing the Database tables which system must have to be able to start running. There is no relation between these tables.

Figure 4.2 Database design

Username Password Email Sections

User_Management

SectionName StartingTime LongClassTime

SectionsTimes StudentID StudentName MacAddress dateOfAttend( several columns with attending date)

Section_Name (aa,ab..etc)

Page 24: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

13

4.3 Structure Design Server- Side Class Diagram

Figure 4.3 class Diagram Server-Side

Client-Side Class Diagram

Main main()

ThreadDealWithClient extands Thread client : Socket ThreadDealWithClient( Socket client) run()

ThreadRecord extands Thread DWD : DealingWithDB run()

DealingWithDB con : Connection culom : int rows : int rs : ReasultSet stmt : Statement CheckUserAccessble(String check) CheckUserTables(String check) FillArreyOfMacFromDB(int a,String Sname ) FillArreyOfTimeFromDB() GetNoOfStudent(String Sname) GetTableColumnsNameAndContent(String TableName) GetTime(String Sname) RecordingAttendance(String Table, int[]d,String[] x)

Main main()

FrameThread extends Thread client : Socket FrameThread(Socket client ) run()

Table extends Thread table : JTable Table(String[] columnName, String[][] data)

Frame totalGUI : JPanel Panel : JPanel password : JTextField username : JTextField Label1 : JLabel Label2 : JLabel Name : String Pass : String Check : String Read : BufferReader Frame : JFrame Pw : PrintWriter Table : String[] Sname : String Section : String Sectionlist : String[] G : int Mo : int X : int Columns : int Rows : int frame(Socket client ) Login_GUI() ViewUserTables_GUI() GetColumnsNames() GetTableData() Run_GUI()

Figure 4.3 Class Diagram Client-Side

Page 25: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

14

4.4 User interface design

User interface will be just in Client-side (for Lecturers).

Figure 4.4.1 is the 1st Frame will be appearing for the Client when client run the software. In this frame user should enter Username and password to access.

Figure 4.4.1 Login interface Figure 4.4.2 is the Frame will appear after Client access the server (send correct username and password). Here in this Frame user should choose one of the section user wants to view.

Figure 4.4.2 SectionsView

Page 26: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

15

Figure 4.4.3 is the page will be appear after client choose a section and it will be contain the section table client had choose it to be viewed.

Figure 4.4.3 SectionTable

Page 27: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

16

Chapter 5

Implementation

Page 28: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

17

Chapter 5: Implementation 5.1 Tools

1.1) H/W: Wireless Device (access point , wireless router , wireless modem), Computer to act as server , hard disk to save Database on it , mobiles support Wi-Fi technology with each Students.

1.2 ) S/W: any Database ( Microsoft office Access, Microsoft SQL, MySQL) , Java compiler ( server can run a java source code ).

5.2 Interface Process Description There are three process in system with interface:

1st process is login. Login process has three prospects:

4.4 Either entry a correct username and password → will move to 2nd process which is ViewSection.

4.5 Or incorrect password or username → will stay in same process which is Login.

4.6 Or close system by closing main frame (which view sections name) → will go to Exit process.

2nd process is ViewSections. ViewSections has two prospects:

v Either choose one of sections wants to view → will move to 3rd process which is ViewTable.

v Or close system by closing main frame(which view sections name) → will go to Exit process.

3rd process is ViewTable. ViewTable has two prospects:

v Either close the frame of table → will move back to 3rd process which is ViewTable.

v Or close system by closing main frame(which view sections name) → will go to Exit process.

Page 29: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

18

5.3 System Processes in background Description

There are several process in system which running in background for taking attendance and record it in Database :

1st system will create connection with Database to be able to read and store from database.

2nd Creating a BufferedReader object to download a html file from Wireless device (which in classroom). 3th Creating a array of String to fill it with students` MacAddress from Database. 4th Analysis the BufferedReader object and compare with the array ( of MacAddress) to decide who is attend and who is not. 5h after known the student attendance system will alter a column in table of section which in database with name of date of system . 6th and last system will record students attendance in the new column that system created depends on info system has.

Page 30: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

19

Chapter 6

Usability Testing

Page 31: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

20

Chapter 6: Usability Testing

6.1 Methods used in usability testing

White Box, because I am the developer and I can see the source code.

6.2 Test design # Software Test Case for Connect user with wireless router: Purpose: The user should be able to connect with wireless router. Pre-requisite:

1) Checking Users ability to connect with the wireless router. 2) Check system ability to know who students absent and who present.

# Software Test Case for recording attendance in database: Purpose: system should record attendance automatically. Pre-requisite:

1) S/w should be compatible with the database. 2) Info about data should be recorded. 3) Record the attendance in database as required.

# Software Test Case for view to user sections` tables which user owned: Purpose: The user should be able to see the sections` table he/she owned . Pre-requisite:

1) Table page should appear. 2) Table page should be user friendly.

# Software Test Case for Login Page: Purpose: The user should be able to go to the Home page (page which contain list of sections` name). Pre-requisite:

1) S/w should be compatible with the Operating system. 2) Login page should appear. 3) Username and Password textboxes should be available with

appropriate labels. 4) Login buttons with appropriate captions should be available..

Page 32: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

21

6.3 Conducting the test

6.3.1 Connect user with wireless router Test Case Id

Test Case Name Steps/Action Expected Results

TC1. Checking Users ability to connect with the wireless router.

Make the wireless router broadcast the network for public. Try to connect a mobile with the router to check.

Display the name of network in the user mobile scan for network page.

TC2. Check server ability to know who students absent and who present.

connect some mobiles with router and disconnect some others.

Server receive info that show which connect and which not .

Table 6.3.1 Connect user with wireless router

6.3.2 recording attendance in database Test Case Id

Test Case Name Steps/Action Expected Results

TC1. Checking connecting between Database and server.

Write some command for database and see the database action.

Database should work with the command sent.

TC2.

Server can find students` address in database to use them to decide what suppose to be recorded.

Give to server some fix mac address and see how it will deal and decide (absent/present)

Server decide to record the true students` status (present/ absent)

TC3.

Check system records in Database only student`s were present and record the rest as absent.

Let server get Mac address table for students after decide their status .

Record the connected student as present and rest as absent.

Table 6.3.2 recording attendance in database

6.3.3 view to user sections` tables which user owned Test Case Id

Test Case Name Steps/Action Expected Results

TC1. Checking ability of system to view list of section that user owned.

Make a fix test table that contain several tables name for a user to test how it will appear .

Should display only users tables list.

TC2. Check server ability to a table from database. Ask server to appear a table .

Server should show up the correct table we have asked for.

Table 6.3.3 view to user sections` tables which user owned

Page 33: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

22

6.3.4 Login Page Test Case Id

Test Case Name Steps/Action Expected Results

TC1. Checking User Interface requirements.

User views the page to check whether it includes UserId and Password textboxes with appropriate labels. Also expects that Submit and Cancel buttons are available with appropriate captions

Screen dispalys user interface requirements according to the user.

TC2.

Textbox for Username should: i)allow alpha-numeric characters{a-z, A-Z} iii) allow numeric characters like{0-9}

i)User types special characters into the textbox.

i)Error message is displayed for numeric data.

TC3.

Checking functionality of the Password textbox: i)Data should be displayed in encrypted format.

ii)User checks whether his data is displayed in the encrypted format.

System accepts data in the encrypted format else displays an error message.

TC4. Checking functionality of 'Login' button.

i)User checks whether 'Login' button is enabled or disabled.

i)System displays 'Login' button as enabled

ii)User clicks on the 'Login' button and expects to view the 'Home' page of the application.

ii)System is redirected to the 'Home' page of the application as soon as he clicks on the 'Login' button.

Table 6.3.4 Login page

6.4 Results All tests` result appeard as expected. So the test passed successfully.

Page 34: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

23

Chapter 7

Conclusion

Page 35: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

24

Chapter 7: Conclusion

7.1 Problems and difficulties Problems which avoid this project from been used at university are :

v Not all the students have mobile with WiFi technology v Can`t control the range of wireless device ( range can go throw wall ) v Need to put a wireless device in each classroom

7.2 Findings

Finding of this project is Fully attendance system working correctly and doing the purpose which it has implemented for. whenever the requirements are available.

7.3 Recommendations

I recommend for anyone would develop this system that build a good database with better tables and develop the system to be able to work with several wireless devices (several classrooms).

7.4 Future work

For future this project can be in different environment like companies or hospitals or even at university but for staff instead of using it for students.

7.5 Conclusion

In conclusion Attendance Using Wireless system is a saving time solution for taking attendance. It`s solving problem which it implemented for. The attendance using wireless system have been done after doing these four main steps. The first step is, configure router with students` mobiles to get their attendance. The second step is, sending attendance`s information from the router to the server. The third step will be in the server side which is filtering received addresses and ensure that student is inside the required area and record them in the database. The last step is, making the lecturers able to connect with server and query about their sections` tables.

Page 36: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

25

List of References

Page 37: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

26

References ( Researches ):

[ 1 ] M U S T A F A , M . , M . . Y A Z I D , a n d W . A E Z W A N I . " S M A R T C H E C K E R : R E A L T I M E M O N I T O R I N G A N D T R A C K I N G S T U D E N T ’ S C L A S S A T T E N D A N C E U S I N G W I R E L E S S P D . " M o L T A ( 2 0 0 7 ) : W e b . 2 2 F e b 2 0 1 1 . < http://www.massey.ac.nz/massey/fms/Molta/Mustafa.pdf> . [ 2 ] J a i n , S a u r a b h , U m a J o s h i , a n d B h u p e s h S h a r m a . " A t t e n d a n c e M a n a g e m e n t S y s t e m . " I n t e r n a t i o n a l S c h o o l o f I n f o r m a t i c s a n d M a n a g e m e n t ( 2 0 0 8 ) : W e b . 2 2 F e b 2 0 1 1 . < http://www.iisjaipur.org/iiim-current-08/MCA_IV_Sem_Pro_Eva/15.Project%20Attendence%20managemnt%20system.pdf> [ 3 ] M A S R U N I , F A R A H A N U . " S T U D E N T ’ S A T T E N D A N C E S Y S T E M U S I N G F I N G E R P R I N T T E C H N O L O G Y . " M A R A U N I V E R S I T Y O F T E C H N O L O G Y ( 2 0 0 6 ) : n . p a g . W e b . 2 2 F e b 2 0 1 1 . < http://eprints.ptar.uitm.edu.my/667/1/FARAHANUM_BINTI_MASRUNI_06_24.pdf> . [4] KAWAGUCHI, Yohei, Tetsuo SHOJI, Weijane LIN, koh KAKUSHO, and Michihik MINOH. "Face Recognition-based Lecture Attendance System." Department of Intelligence Science and Technology, Graduate School of Informatics, Kyoto University Academic Center for Computing and Media Studies, Kyoto University 1-5. Web. 26 Jun 2011. <http://www.mm.media.kyoto-u.ac.jp/research/doc/682/FRLASinAEARU.pdf>. [5] Wyk, Carel. "Design Of An Automated Class Attendance Recording System." Engineering in the Department of Electrical and Electronic Engineering at the University of Stellenbosch (2008): n. pag. Web. 26 Jun 2011. <http://students.ee.sun.ac.za/~cvw/files/Wifi%20RFID%20Scanner.pdf>.

References ( WebPages ): http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-microsoft-sql-server-using-jdbc.html http://netbeans.org/kb/docs/ide/java-db.html http://netbeans.org/kb/docs/php/wish-list-lesson7.html http://wiki.netbeans.org/GetStartedwithJavaDB http://intuitiveedesign.wordpress.com/2011/06/05/review-of-literature-for-improving-attendance-in-secondary-schools/

Page 38: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

27

Appendix

(Complete code)

Page 39: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

28

Appendix (Complete code): a.1 Server-side Main class package Server; import java.io.*; import java.net.*; import java.sql.SQLException; import java.util.*; class Main { public static void main(String[] args) throws IOException, SQLException { ThreadRecord thread = new ThreadRecord(); thread.start(); ServerSocket SS = new ServerSocket(2010); Socket clinet; while (true) { clinet = SS.accept(); ThreadDealWithClient clientThread = new ThreadDealWithClient(clinet); clientThread.start(); } } }

Page 40: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

29

a.2 Server-side part 1 (class extends from thread reading from Router and record in DB) // Class which send and reicive from client side class ThreadDealWithClient extends Thread { static Socket clinet; public ThreadDealWithClient(Socket clinet) { this.clinet = clinet; } @Override public void run() { try { DealingWithDB DWD = new DealingWithDB(); PrintWriter pw = new PrintWriter(new OutputStreamWriter(clinet.getOutputStream()), true); BufferedReader read = new BufferedReader(new InputStreamReader(clinet.getInputStream())); String Recived, m = ""; int column, row; // following loop will be keep looping until the client send a correct Username and password while (true) { Recived = read.readLine().trim(); m = DWD.CheckUserAccessble(Recived); pw.println(m); pw.flush(); if (m.equalsIgnoreCase("yes")) { break; } } String[] user = Recived.split(":"); Recived = read.readLine().trim(); Recived = DWD.CheckUserTables(user[0]); pw.println(Recived.trim()); pw.flush(); // following loop will keep trying until the client close program while (true) { Recived = read.readLine().trim(); String table = ""; table = DWD.GetTableColumnNamesAndContent(Recived); Recived = read.readLine().trim(); row = new DealingWithDB().rows; column = new DealingWithDB().culom;

Page 41: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

30

pw.println(row); pw.flush(); pw.println(column); pw.flush(); pw.println(table); pw.flush(); } } catch (Exception e) { } } }

Page 42: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

31

a.2 Server-side part 2 (class extends from thread to Deal with Client) // this class for taking attendance from router and record it in Database class ThreadRecord extends Thread { static DealingWithDB DWD; public void run() { int i = 0, x = 0, g = 0, a, j = 0, m = 0; int d[] = null; try { BufferedReader in = null; DWD = new DealingWithDB(); String Sname[] = null; Sname = DWD.FillArreyOfTimeFromDB(); Calendar cal = new GregorianCalendar(); while (m < Sname.length) { a = DWD.GetNoOfStudent(Sname[m]); int k[] = new int[a]; String StudentsMacAddress[] = new String[a]; StudentsMacAddress = DWD.FillArreyOfMacFromDB(a, Sname[m]); d = DWD.GetTime(Sname[m]); g = d[2] / 10; while(cal.get(Calendar.HOUR)!=d[0]||cal.get(Calendar.MINUTE)!=d[1]){ sleep(60000); }; for (j = 0; j < 10; j++) { while(cal.get(Calendar.HOUR)!=d[1]||cal.get(Calendar.MINUTE)!=d[1]){ sleep(60000); }; x = 0; String userPassword = "admin:admin"; // the following loop will keep try to connect to the router // because sometimes router dose not response from 1st try while(true){ try{ URL RouterPage = new URL("http://192.168.1.1/setup.cgi?todo=nbtscan&next_file=WClientMACList.htm"); URLConnection yc = RouterPage.openConnection(); String encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes()); yc.setRequestProperty("Authorization", "Basic " + encoding); in = new BufferedReader(new InputStreamReader(yc.getInputStream())); break;

Page 43: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

32

}catch(Exception e){} } String inputLine; while ((inputLine = in.readLine()) != null) { i = 0; while (i < StudentsMacAddress.length) { if (inputLine.contains(StudentsMacAddress[i])) { k[i]++; } i++; } x++; } in.close(); if (cal.get(Calendar.MINUTE) + g < 60) { d[1] = d[1] + g; } else { d[1] = d[1] + ((cal.get(Calendar.MINUTE) + g) - 60); d[0]++; } } i = 0; while (i < StudentsMacAddress.length) { if (k[i] >= 6) { k[i] = 1; } else { k[i] = 0; } i++; } DWD.RecodingAttendance(Sname[m], k, StudentsMacAddress); m++; } } catch (Exception e) { e.printStackTrace(); } } }

Page 44: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

33

a.4 Server-Side DealingWithDB class package Server; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import java.util.Calendar; import java.util.GregorianCalendar; public class DealingWithDB { static Connection con; static ResultSet rs; static java.sql.Statement stmt; static int culom, rows; // used constractor to identfie the static valuse(DB connection) once public DealingWithDB() throws SQLException { try { Class.forName("org.apache.derby.jdbc.ClientDriver"); con = DriverManager.getConnection("jdbc:derby://localhost:1527/Attendance", "admin", "admin"); stmt = con.createStatement(); } catch (ClassNotFoundException e) { System.out.println(e); } } // this will method will take the name of section as parmeter and use it to get array which contain mac Address public String[] FillArreyOfMacFromDB(int a, String Sname) throws SQLException { String StudentsMacAddress[] = new String[a]; rs = stmt.executeQuery("select * from APP." + Sname); int i = 0; while (rs.next()) { String s = rs.getString("MacAddress"); StudentsMacAddress[i] = s.trim(); //System.out.println(s);

Page 45: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

34

i++; } return StudentsMacAddress; } public int GetNoOfStudent(String Sname) throws SQLException { int i = 0; rs = stmt.executeQuery("select * from APP." + Sname); while (rs.next()) { i++; } return i; } // this method for getting array of list of section and thier starting time and order them depond on time public String[] FillArreyOfTimeFromDB() throws SQLException { rs = stmt.executeQuery("select * from APP.SECTIONTIME order by startingtime asc"); int i = 0; while (rs.next()) { i++; } String Sname[] = new String[i]; int kk[] = new int[i]; i = 0; rs = stmt.executeQuery("select * from APP.SECTIONTIME order by startingtime asc"); while (rs.next()) { String s = rs.getString("SectionName"); Sname[i] = s.trim(); i++; } return Sname; } // this method to get starting time of the section which it`s name giving as parmaeter public int[] GetTime(String Sname) throws SQLException { int d[] = new int[3]; int w = 0; rs = stmt.executeQuery("select * from APP.SectionTime where sectionname = '" + Sname + "'"); int i = 0, s = 0; while (rs.next()) { s = rs.getInt("StartingTime");

Page 46: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

35

w = rs.getInt("LongClassTime"); } d[0] = s / 100; d[1] = (d[0] * 100 - s); d[2] = w; return d; } // this method for record attendance in database (who is present and who is absent) //it takes 3 parameters name of section, list of student addresses and list of thier status public void RecodingAttendance(String table, int d[], String x[]) throws SQLException { Calendar cal = new GregorianCalendar(); String o = Integer.toString(cal.get(Calendar.getInstance().MONTH)); o = "Date_" + o + "_" + Integer.toString(cal.get(Calendar.getInstance().DATE)); stmt.executeUpdate("ALTER TABLE APP." + table + " ADD " + o + " VARCHAR(12)"); String m; for (int i = 0; i < d.length; i++) { m = Integer.toString(d[i]); stmt.executeUpdate("update App." + table + " set " + o + " = '" + m + "' where macaddress='" + x[i] + "'"); } } // this method to check if user connecting with the system as a client has accessablility or not. //it takes username and password recived from client and return either can access or not (string of yes or no) public String CheckUserAccessble(String check) throws SQLException { String userpass[] = check.split(":"); rs = stmt.executeQuery("select * from APP.user_mangement"); String w = null, s = null, result = "no"; while (rs.next()) { s = rs.getString("username"); if (s.equalsIgnoreCase(userpass[0])) { w = rs.getString("password"); if (w.equals(userpass[1])) { result = "yes"; break; } else { break; } }

Page 47: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

36

} return result; } // this method to get names of tables which user connecting own. //it takes username as parameter and return sections name. public String CheckUserTables(String check) throws SQLException { rs = stmt.executeQuery("select * from APP.user_mangement where username = '" + check + "'"); String result = ""; rs.next(); result = rs.getString("sections"); return result; } //this method to get section table. //it takes section name as parameter and return array of 2D which has data of table. public String GetTableColumnNamesAndContent(String TableName) throws SQLException { int i = 1, j = 0, q; rs = stmt.executeQuery("select * from APP." + TableName); String m = ""; while (rs.next()) { j++; } int vc = rs.getMetaData().getColumnCount(); String table = ""; culom = vc; rows = j; j = 0; while (i <= vc) { m = rs.getMetaData().getColumnName(i); table = table + m + ","; i++; } i = 0; j = 0; rs = stmt.executeQuery("select * from APP." + TableName); // prpblem while (rs.next()) { while (i < vc) { table = table + rs.getString(i + 1) + ","; i++; } i = 0; j++; }

Page 48: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

37

return table; } b.1 Client-Side Main class package Cilent; import java.io.IOException; import java.net.*; public class Main { public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException { Socket client = new Socket("127.0.0.1", 2010); FrameThread ObjectFrameThread = new FrameThread(client); ObjectFrameThread.start(); } }

Page 49: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

38

b.2 Client-Side part 1 (frame class ) package Cilent; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import java.net.Socket; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; public class frame { static JPanel totalGUI,Panel; static JTextField username,password; static JLabel Label1,Label2; static String name = "",pass = "",check = "", section,Sname; static BufferedReader read; static JFrame frame; static PrintWriter pw; static String[] table = null; static String sectionslist[] = new String[6]; static int mo, columns, rows,g=0,x=0; public frame(Socket client) throws IOException { pw = new PrintWriter(new OutputStreamWriter(client.getOutputStream()), true); read = new BufferedReader(new InputStreamReader(client.getInputStream())); } // following method for login frame JPanel Login_GUI() { totalGUI = new JPanel(); totalGUI.setLayout(null); totalGUI.setBackground(Color.WHITE); Panel = new JPanel(); Panel.setLayout(null); Panel.setLocation(0, 0); Panel.setSize(300, 200); totalGUI.add(Panel); username = new JTextField(); username.setLocation(140, 20); username.setSize(120, 40); Panel.add(username);

Page 50: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

39

password = new JPasswordField(); password.setLocation(140, 65); password.setSize(120, 40); Panel.add(password); Label1 = new JLabel("Username : "); Label1.setLocation(50, 20); Label1.setSize(120, 40); Panel.add(Label1); Label2 = new JLabel("Password : "); Label2.setLocation(50, 65); Label2.setSize(120, 40); Panel.add(Label2); JButton Submit = new JButton("Login"); Submit.setLocation(100, 120); Submit.setSize(100, 50); Panel.add(Submit); Submit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // Connecting with server will start here and if the user fill a username and password in the frame try { name = username.getText(); pass = password.getText(); if (!name.isEmpty() && !pass.isEmpty()) { pw.println(name + ":" + pass); pw.flush(); check = read.readLine().trim(); if (check.contains("yes")) { frame.setVisible(false); frame.dispose(); x = 1; } else { username.setText(""); password.setText(""); JOptionPane.showMessageDialog(frame, " Your Entire Password \nor Username is not coorect"); } } else { username.setText(""); password.setText(""); JOptionPane.showMessageDialog(frame, "Username and password Fields \n can`t be empty");

Page 51: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

40

} } catch (IOException ex) { Logger.getLogger(frame.class.getName()).log(Level.SEVERE, null, ex); } } }); totalGUI.setOpaque(true); return totalGUI; } // the following method for show up a frame contain the lecturer`s section JPanel VeiwUserTables_GUI() throws IOException { int y = 0,i = 0;; totalGUI = new JPanel(); totalGUI.setLayout(null); totalGUI.setBackground(Color.WHITE); Panel = new JPanel(); Panel.setLayout(null); Panel.setLocation(0, 0); Panel.setSize(280, 600); totalGUI.add(Panel); pw.println("send"); pw.flush(); section = read.readLine().trim(); sectionslist = section.split(","); i = 0; // following loop for creating No. buttons as much as No. Lecturer`s section for (i = 0; i < sectionslist.length; i++) { if (i == 0) { y = 80 * (i + 1); JButton Submit = new JButton(sectionslist[i]); Submit.setLocation(40, y); Submit.setSize(200, 40); Panel.add(Submit); Submit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[0]); pw.flush(); x = 1; } });

Page 52: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

41

} if (i == 1) { y = 80 * (i + 1); JButton Submit2 = new JButton(sectionslist[i]); Submit2.setLocation(40, y); Submit2.setSize(200, 40); Panel.add(Submit2); Submit2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[1]); pw.flush(); x = 1; } }); } if (i == 2) { y = 80 * (i + 1); JButton Submit3 = new JButton(sectionslist[i]); Submit3.setLocation(40, y); Submit3.setSize(200, 40); Panel.add(Submit3); Submit3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[2]); pw.flush(); x = 1; } }); } if (i == 3) { y = 80 * (i + 1); JButton Submit4 = new JButton(sectionslist[i]); Submit4.setLocation(40, y); Submit4.setSize(200, 40); Panel.add(Submit4); Submit4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[3]); pw.flush(); x = 1;

Page 53: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

42

} }); } if (i == 4) { y = 80 * (i + 1); JButton Submit5 = new JButton(sectionslist[i]); Submit5.setLocation(40, y); Submit5.setSize(200, 40); Panel.add(Submit5); Submit5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[4]); pw.flush(); x = 1; } }); } if (i == 5) { y = 80 * (i + 1); JButton Submit6 = new JButton(sectionslist[i]); Submit6.setLocation(40, y); Submit6.setSize(200, 40); Panel.add(Submit6); Submit6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pw.println(Sname = sectionslist[5]); pw.flush(); x = 1; } }); } } totalGUI.setOpaque(true); return totalGUI; } // following method to create a array of String which is the culomns names that table has public String[] GetColumnsNames() throws IOException { pw.println("send"); pw.flush(); rows = Integer.parseInt(read.readLine());

Page 54: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

43

columns = Integer.parseInt(read.readLine()); String[] ColumnsName = new String[columns]; int i = 0; mo = 0; check = read.readLine().trim(); table = check.split(","); for (i = 0; i < columns; i++) { ColumnsName[i] = table[mo]; mo++; } return ColumnsName; } // following method to create a 2D array of String which is the table public String[][] GetTableData() throws IOException { String[][] Data = new String[rows][columns]; int i = 0, j = 0; for (j = 0; j < rows; j++) { for (i = 0; i < columns; i++) { Data[j][i] = table[mo]; mo++; } } return Data; } // following method is to control which frame show up and which not public void Run_GUI() throws IOException, InterruptedException { JFrame.setDefaultLookAndFeelDecorated(true); frame = new JFrame(); //Create and set up the content pane. while (x != 99) { x = 0; if (g == 0) { frame.setContentPane(Login_GUI()); frame.setTitle("Login"); frame.setSize(310, 230); frame.setLocation(550, 200); } else if (g == 1) { frame.setContentPane(VeiwUserTables_GUI()); frame.setTitle("SectionsView"); frame.setLocation(550, 80); frame.setSize(280, 600); } else { Table gui = new Table(GetColumnsNames(), GetTableData()); gui.setSize(1024, 750); gui.setTitle("Section " + Sname);

Page 55: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

44

gui.setLocation(0, 0); gui.setVisible(true); } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBackground(Color.WHITE); frame.setVisible(true); while (x == 0) { Thread.sleep(2000); } g++; } } }

Page 56: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

45

b.3 Client-Side part 2 (class FrameThread) package Cilent; import java.net.Socket; public class FrameThread extends Thread { Socket client; public FrameThread(Socket client) { this.client = client; } public void run() { try { frame ObjectFrame = new frame(client); ObjectFrame.Run_GUI(); } catch (Exception e) { } } }

Page 57: Attendance Using Wireless - personal.stevens.edupersonal.stevens.edu/~mkutbi/attendance_2011.pdf · 3.4.2Data flow diagram/ class diagram ... 6.3.2 recording attendance in database

46

b.4 Client-Side part 3 (class Table extends from JTable) package Cilent; import java.awt.*; import javax.swing.*; public class Table extends JFrame { JTable table; public Table(String[] columnNames, String[][] data) { setLayout(new FlowLayout()); table = new JTable(data, columnNames); table.setPreferredScrollableViewportSize(new Dimension(950, 700)); table.setFillsViewportHeight(true); JScrollPane scrollPane = new JScrollPane(table); add(scrollPane); } }