Report

Page 1

SHATIN TSUNG TSIN SECONDARYSCHOOL HKCEE 2009 Computer and Information Technology Coursework Multiple-Choice Analysis Report

Name:

Law Shan

Class:

5A(20)

Supervisor

Mr. Lee Kin Chung


Content 1. Introduction .........................................................................................................4 - Background ........................................................................................................ 4 - Objectives ........................................................................................................ 6 - Task Objective .................................................................................... 6 - Learning Objective .............................................................................8

2. Analysis ................................................................................................................. 11 - Choice of Language ........................................................................................... 11 - Rationale of choosing language ......................................................................... 12

3. Design .................................................................................................................... 17 - Project Planning ................................................................................................. 17 - Project specification ........................................................................................... 19 - Main Menu ......................................................................................... 19 - Individual entry................................................................................... 20 - Searching entry .................................................................................. 21 - Filtering entry .................................................................................... 23 - Display Report ................................................................................... 26 - Awards ................................................................................................ 29 - Editing entry .......................................................................................31 - Output Report......................................................................................33 - Operation Rules ................................................................................................. 34 - Program Flow Chart ........................................................................................... 36

4. Implementation .................................................................................................. 37 - Samples .............................................................................................................. 37 - File Structure ...................................................................................................... 46

2


- Program listing ................................................................................................... 47

5. Testing and Evaluation .................................................................................... 83 - Testing table ....................................................................................................... 83 - First Test (26 / 8 / 2008) .................................................................... 83 - Second Test (15 / 9 / 2008) ................................................................ 92

6. Discussion and Conclusion ............................................................................. 101 - Discussion ..........................................................................................................101 - Strengths of the program .................................................................... 101 - Weaknesses of the program ................................................................ 103 - Suggest improvements ........................................................................ 104 - Conclusion ......................................................................................................... 105

7. Reference .............................................................................................................. 107 - Books ................................................................................................................. 107 - Websites ............................................................................................................. 108

3


Introduction - Background Information

Since the use of computer is very common nowadays, lots of work can be done by using computer and with suitable software. Computer is highly reliable that it seldom fails. It also has a high accuracy that it never does wrong things unless bug presents. The large capacity and high processing speed make computer more popular as it records many files and saves lots of time for people to do other things. Therefore, the applications of computer are varied. Multiple-choice questions always related closely to our daily life. It appears in your tests, work and examinations. We do the questions carefully to make sure that we fill in the correct blanks. However, how do you feel if the marker marks wrongly? In the past, people marked multiple-choice questions and collected data manually. Therefore, it was very time-consuming and wasted lots of manpower. If you want to save the data in computer, you need to key in the large amount of data at once. Therefore, mistakes are made easily by marking manually. In 1951, David Sheppard invented the first Optical Character Recognition (OCR). At first, OCR could only recognize English characters. Nowadays, this technology is greatly developed. It can also recognize Chinese characters. Thus, it has been applied to different areas, such as business, research, study, etc. OCR helps a lot, especially in business. For example, the bank handles a huge numbers of data for investments and this may cause a gain or lost. If there is any mistake or delay when handling the data and costs a lost of its

4


Introduction - Background Information

client, it needs to compensate for the lost. As the time of using OCR to input data in computer is very fast, we can save time and manpower. Also, it can afford the manual mistakes. Therefore, the problems mentioned before can be solved. Moreover, OCR also helps a lot when marking multiple-choice questions. When the multiple-choice answer sheet is put into the OCR, it scans the answer as an image. Then, the image is changed to characters. Thus, the answer we had chosen can be correctly input into computer and the analysis of the results can be carried out then. OCR is so user-friendly that we can use it without any expertise. Thus, it is used by teachers, students and researchers. We can have many detailed multiple-choice analyses because of OCR. It saves lots of resources for us to do these analyses.

5


Introduction - Task Objectives

In this coursework, a program is used to produce a detailed analysis report on an inter-school mathematics competition, which is in the form of multiple-choice questions. The program should contain the following functions: First, the program will contain a menu function which can let the user to choose different functions. On the main menu, there will be eight options: showing individual entry, search entry, filter entry, display report, award, edit entry, output report and exit. Having a menu with instructions is clear and convenient for user to use as the user does not need to think of the techniques for using the program. Moreover, the user does not need to input anything, except searching, this reduces the chance of making transcription errors. Second, it will have a bar chart function which shows the position of the each participant and the analysis graphically. This has an advantage that the user can see clearly and immediately where the positions of students are in the ranking. Also, the user does not need to create a chart by himself/ herself. Third, the program will have a function which helps the user to produce a text file. Thus, the user can print out the report in the form of text only. It is more convenient than printing different parts of the report one by one which waste a lot of time and ink. Forth, this program will have a function which allows the user to search specific entry. He can search by ranking, age, id, school and name, etc. It provides a faster method for the user to read a specific data. This saves lots of time, especially for the competition

6


Introduction - Task Objectives

which holds a lot of data. To search by ranking, the user can quickly find out which participants is at the top of the list and who is at the bottom. To search by age, the user can know participants at which age can do better in the competition. To search by id, to user can rapidly find out the data of specific participant which save time for searching one by one. Sometimes, searching one by one can also miss the data you want. Thus, this can ensure you will not miss out any. To search by school, the user can quickly find out all participants who are from the same school. If the user search one by one, he may also miss some.

To

search by name, it is just as same as search by id. However, there maybe more than one participant whose name are the same. In this condition, the user have to check with the other data and cause inconveniences. There is still a benefit, if the user does not know the id of the participant.

7


Introduction - Learning Objectives

Doing this project, writing program, typing project and doing presentation, all the things have to be done by myself. Although I had done a project of Computer and Information Technology before, this is the first time I do the whole project individually. Therefore, I hope I can learn more than before. The things that I had learnt are listed as following: First, it will enhance my programming skills. In this project, the programming language I used is pascal. Although I have been learning it since form three, I found that what I had learnt in the lesson is not sufficient. In order to meet my planning, I have to find out some other skills on the Internet and try to digest it all by my own. Also, debugging is a great experience for me to improve the programming skills as I can discover my own mistakes and solve it. Therefore, I will never make the same mistake again. Second, I can improve my English. Doing this project, I have to type the report in English. I need to explain every step of the project clearly without leading any misunderstanding. Therefore, no matter more or less, my English must have been improved. The benefit is long lasting. Third, I can enhance my presentation skills. In this project, I have to present my program to teachers and classmates. I have to present it with PowerPoint, thus, I can revise the use of PowerPoint and this improved my skills on PowerPoint. Forth, I can improve my problem solving skills. In this project, the report includes

8


Introduction - Learning Objectives

analysis and implementation; I will learn how to divide a big problem into different parts so I can solve smaller problems easily. Also, during debugging, I have to figure out which parts go wrong and solve it. Therefore, my problem solving skills will be improved a lot. This will be beneficial for my next project soon or late in the future. Fifth, I can be braver. During the presentation, I have to face my teachers and classmates. I present my program to them by using English. That is no easy task. I have to overcome the pressure made by my teachers and classmates. I leave my comfort zone to use a foreign language. I am brave. Sixth, I can increase the knowledge in Internet. Doing the program, I have to search some websites which teach people the skills of pascal. I discover that using Internet can do many things. Also, I find some skills which help me to search things easier. Moreover, I know which search engine is better now. Seventh, I can increase my knowledge in technology. During the process, I have to search some history of OCR. This will build up my mind on OCR. Also, this can broaden my horizon in technology. Since the invention of OCR, there are numerous types of OCR in the world that I could never dream of. Last, I am more interested in technology and computer. As computer can do many things for us and brings lots of convenience, I will be more interested in computer to find out more benefit of it and make my life become easier. I am interested in technology now. I

9


Introduction - Learning Objectives

become more interested in comparing the difference between two different brands of electric appliances like mobile phone, computer, printer, etc. to figure out the strengths and weaknesses between them. I really get lots of experiences and benefit from this project. Doing this project is no easy task for me, but I finished it at last.

10


Analysis - Choice of Language

As the technology has improved a lot, there are many different types of programming language and their attributes are different. Different attributes such as speed, size, compatibility, etc. of programming language cause a big difference in your program as some programming languages may not be able to do some tasks. Therefore, choosing a suitable programming language is extremely important and essential before the program is developed. „

Choice of language After analysis, I prefer choosing Pascal to other programming languages for my

project. Also, I have found some information about Pascal on the Internet. According to Wikipedia:

“Pascal has its roots in the Algol 60 language, but also introduced concepts and mechanisms which (on top of Algol's scalars and arrays) enabled programmers to define their own complex (structured) datatypes, and also made it easier to build dynamic and recursive data structures such as lists, trees and graphs. Important features included for this were records, enumerations, subranges, dynamically allocated variables with associated pointers, and sets. To make this possible and meaningful, Pascal has a strong typing on all objects, which means that one type of data cannot be converted or interpreted as another without explicit conversions. Similar mechanisms are standard in many programming languages today.� Therefore, Pascal is suitable to use in this because the features and function of pascal can fulfill the requirement of the program in the project.

11


Analysis - Rationale of choosing language

In this part, I would like to compare a number of programming languages about their strengths and weaknesses so as to find out a suitable language in this project. 1. Pascal z

Strengths of Pascal Pascal is easy to use and understand. Therefore, it is easy for user to debug. Moreover, the excute speed is fast enough to handle the program. Pascal has a very high compatibility as the compiled excutable file can be run on most platform. Also, the program can be very user-friendly as the layout of the program can not be very complicated. In addition, Pascal is a free ware, people can access to the official website and download it with no charge.

z

Weaknesses of Pascal The storage capacity of Pascal is smaller compare with the other programming languages. For example, the range of integer is only ranged from -32767 to 32768. Therefore, a larger number cannot be calculated.

2. PHP (PHP: Hypertext Preprocessor) z

Strengths of PHP User of PHP does not need to download excludable program as it is run on server. Also, the program is run on the server through Internet, thus, this provides an interactive act. Moreover, the webpage layout is depended on the

12


Analysis - Rationale of choosing language

design so the interface is user friendly. In addition, PHP is an open source program. Thus, we do not need to pay before using it. Last but not least, the compatiblity is high because the users only receive webpages. Therefore, the program can be used in most platforms and OS such as Window, Linux and Mac OS. z

Weaknesses of PHP This program must need the setup of server to compile. If the server is down, the program cannot be used. Moreover, it is really unconvenient that everytime the user wants to use it, he needs to connect to the Internet and have browsers to run the program. If the network is not accessable, he cannot use the program also. The stability of the program is depended on the server. Therefore, when the server is overloaded, the stability is a question.

3. Java z

Strengths of Java People can access to the Internet to its official website and download the development kit to develop Java program as Java is an open source programming language.

z

Weaknesses of Java A higher requirement of computer is needed for running the Java program.

13


Analysis - Rationale of choosing language

Also, before running a Java program, the user has to install the Java platform for the Java program to run. 4. C++ z

Strength of C++ The strength of C++ is that the requirement of the computer is low for running a compiled executed file of C++. Therefore, it can be run in most computers and is quite portable. C++ supports both Structured Programming and Object-Oriented Programming. When comparing with the other programming languages, The processing speed of C++ is faster.

z

Weaknesses of C++ The weaknesses of C++ are most users do not want. It is because programmer needs to PAY before writing the program as most compiler of C++ are not free. Furthermore, the user has to download the program before they can run it and there is less interaction between users.

5. Visual Basic z

Strengths of Visual Basic The most significant strength of Visual Basic is that it is in Graphical User Interface (GUI) . Therefore, the program is user friendly. The code of Visual Basic is easy to understand so it is more easy for programmer to debug.

14


Analysis - Rationale of choosing language

z

Weaknesses of Viusal Basic First, visual basic is a program developed by the Microsoft Co. , therefore , we need to purchase the software before we can use it. Users may not be willing to use it. Moreover, some extensions drivers have to be installed to use the functions of the program as its file size is quite large. If the user do not install the extensions delivers, the program may not be run. Furthermore, the program can only be run in Window environment.

From the above information, a table can be drawn for easier and clear comparison: Pascal

PHP

C++

Java

Visual Basic

Product

Executable file

Webpage

Executable file

Executable file

Executable file

Interface

Console

GUI

GUI

GUI

GUI

Open source

No

Yes

No

Yes

No

Free ware

Yes

Yes

No

Yes

No

Compatibility

Medium

Depends

High

High

Medium

Medium

Difficult

Difficult

Easy

Understandable Easy

15


Analysis - Rationale of choosing language

Conclusion: After comparing with the other programming languages, Pascal has lots of advantages. Although Pascal is not the best in each comparison, it does better in average. The product of the programming languages does not affect my choice. Thus, I just left it behind. Pascal is not Graphical User Interface(GUI) so it is a disadvantage. However, it is not a big deal. Pascal, C++ and Visual Basic are not open source while PHP and Java are. Nevertheless, when I look at category that is it a free ware, Pascal can still take a place as it is a free aware. Money is my first concern. When I look at the compatibly, pascal is not that bad. It is better than PHP as PHP is not stable. It comes to the important part, the easiness of writing the program. Pascal is the easiest among the three free wares. Therefore, Pascal is used by me at last. The above conclusion can be express clearly and be easier to understand by drawing a flow chart.

16


Design - Project Planning

A Project plan is set up before the beginning of the project: Date

Task

15-17/5/2008

Research of different programming languages

18-20/5/2008

Analysis of different programming languages

28/5/2008

Study of guideline

30/5/2008

Submission of draft project proposal

26-27/6/2008

Adjustment of the draft project proposal

4/7/2008

Submission of project proposal

10/7/2008

Design the whole flow path of the program

18/7/2008

Construct the main program

24/7/2008

Study Pascal on the Internet

5/8/2008

Construct the functions

20/8/2008

Develop further functions

26/8/2008

First testing and debuging

1/9/2008

First adjustment of program

15/9/2008

Final testing and bugging

22/9/2008

Demonstration of product

15/10/2008

Research of OCR

17


Design - Project Planning

31/10/2008

Submission of draft report

1-3/11/2008

Prepare for presentation

4/11/2008

Oral Presentation

18-20/11/2008

Adjustment of report

10/12/2008

Submission of report and CD-ROM

18


Design - Project Specification

1.

Main Menu The main menu is the first page of the program that the user will see if he types in

the correct pathway of the program. A banner is shown at the top of the main menu showing ‘Welcome to the MC analyzer’. Also, the user can see a menu which shows eight options:

Welcome to the Multiple-Choice analyzer

1. 2. 3. 4. 5. 6. 7. 8.

Show individual entry Search entry Filter entry Display report Awards Edit entry Output report Exit

The main menu

19


Design - Project Specification

2.

Individual entry After choosing ‘individual entry’, the program will show each individual entry which contains every datum. When you press the space bar, it will show another individual entry. If you press ‘E’, you will enter to the edit menu. Then, if you press ‘Esc’, the program will go back to the main menu.

Show individual data Name: CHAN CHUN MAN Sex: M Age: 18 School: Shatin Tsung Tsin Secondary School Answer: ABCDACBCDABCDDCBADCABACDB Checking: OOOXXOXOOOXOOOOOXOOOXOOX Marks: 34 Ranking: 128 ======================== 1/172 ======================= Press SPACE to enter next page Press ESC to Exit

Individual entry

20


Design - Project Specification

3.

Searching entry After choosing ‘search entry’, the program will show another menu which contains the other four options:

Search Entry

1. 2. 3. 4.

Search by name Search by ID Search by ranking Back to menu

Search entry menu i)

Search by name When the user chooses ‘search by name’, the program will ask the user to input the name of the participant he wants to search. If the input from the user is present in the program, the program will show the individual entry of the searched participant.

Search Entry Please enter the name for searching:

Search by name ii)

Searching by id

21


Design - Project Specification

When the user chooses ‘search by id’, the program will ask the user to input the id of the participant he wants to search. If the input from the user is present in the program, the program will show the individual entry of the searched participant.

Search Entry Please enter the ID for searching:

Search by ID iii)

Searching by ranking When the user chooses ‘search by ranking’, the program will ask the user to input the ranking of the participant he wants to search. If the input from the user is present in the program, the program will show the individual entry of the searched participant.

Search Entry Please enter the ranking for searching:

Search by ranking iv)

Back to menu When the user choose ‘back to menu’, the program will go back to the

22


Design - Project Specification

main menu. 4.

Filtering entry After choosing ‘filter entry’, the program will show another menu which contains another six options:

Filter Entry

1. 2. 3. 4. 5. 6.

Filter by sex Filter by age Filter by school Filter by mark Filter by ranking Back to menu Filter entry menu

i)

Filtering by sex when the user chooses ‘filter by sex’, the program will ask the user to input ‘M’ or ‘F’ which represents male and female respectively. If the input is ‘M’, the program will show all data of male participants. If the input is ‘F’, the program will show all data of female participants.

Filter entry Please select M/F: Filter by sex ii)

Filtering by age When the user chooses ‘filter by age’, the program will ask the user to input age he wants to search. If the data is in the program, the

23


Design - Project Specification

program will show all participants who are in the searched-age.

Filter entry Please input the age: Filter by entry iii)

Filtering by school When the user chooses ‘filter by school’, the program will ask the user to input the school code he wants to search. If the data is in the program, the program will show all participants who belong to the searched-school.

Filter entry Please input the school code: Filter by school iv)

Filtering by mark When the user chooses ‘filter by mark’, the program will ask the user to input a mark he wants to search. Then, the program will further ask the user whether he wants to filter the data which are greater than the mark or smaller than. If the data is in the program, the program will show all participants who are in the range of searched-mark.

24


Design - Project Specification

Filter entry

Please input the mark: 34 Greater<1> or smaller<2> than 34: Filter by mark v)

Filtering by ranking When the user chooses ‘filter by ranking’, the program will ask the user to input a ranking he wants to search. Then, the program will further ask the user whether he wants to filter the data which are greater than the ranking or smaller than. If the data is in the program, the program will show all participants who are in the range of searched-ranking.

Filter entry

Please input the ranking: 120 Greater<1> or smaller<2> than 120: Filter by ranking vi)

Back to menu When the user choose ‘back to menu’, the program will go back to the main menu.

25


Design - Project Specification

5.

Display Report After choosing ‘display report’, the program will show another menu which contains another four options:

Display report 1. 2. 3. 4.

Candidates analysis Schools analysis Questions analysis Back to menu Display report menu

i)

Candidates analysis When the user chooses ‘candidates analysis’, the program will display candidates analysis.

Display report Total candidate: 172 Total school: 20 Male: 92 Female: 80 Age 16: 34 Age 17: 31 Age 18: 29 Age 19: 40 Press any key to next page….. Display report

26


Design - Project Specification

ii)

schools analysis When the user chooses ‘schools analysis’, the program will display schools analysis.

Display report

CUHKFAA CHAN CHUN HA SECONDARY SCHOOL Students: 3 Marks: 113 GCC&ITKD LAU PAK LOK SECONDARY SCHOOL Students: 11 Marks: 406 JOCKEY CLUB TI-I COLLEGE Students: 3 Marks: 112 Page1/4

Schools analysis

27


Design - Project Specification

iii)

Questions analysis When the user chooses ‘questions analysis’, the program will display questions analysis.

Display report

Q1 | Correct: 136 <79%> Q2 | Correct: 127 <74%> Q3 | Correct: 132 <77%> Q4 | Correct: 135 <78%> Q5 | Correct: 134 <78%> Q6 | Correct: 134 <78%> Q7 | Correct: 132 <77%> Q8 | Correct: 130 <76%> Page 1/6

Question analysis iv)

Back to menu When the user choose ‘back to menu’, the program will go back to the main menu.

28


Design - Project Specification

6.

Awards After choosing ‘awards’, the program will show another menu which contains another three options:

Awards 1. Awards for students 2. Awards for schools 3. Back to menu Awards menu i)

Awards for students When the user chooses ‘awards for students’, the program will display all the awards which are given to students.

Awards Gold award: CHAN SHUK YAN Silver award: CHAN WING SHAN Bronze award: YU HIU TONG Honorable Mentions: FUNG MING KIT YU SAU CHU KU KA MING KONG SHING YU Press any key to continue…..

Awards for students

29


Design - Project Specification

ii)

Awards for schools When the user chooses ‘awards for schools’, the program will display all the awards which are given to schools.

Awards Gold award: HKCWC FUNG YIU KING MEMORIAL SCHOOL Silver award: PENTECOSTAL LAM HO KONG SCHOOL Bronze award: NG YUK SECONDARY SCHOOL Honorable Mentions: MA ON SHAN TSUNG TSIN SECONDARY SCHOOL MA ON SHAN ST JOSEPH’S SECONDARY SCHOOL LOCK TAO SECONDARY SCHOOL Most Participates: NG YUK SECONDARY SCHOOL LOCK TAO SECONDARY SCHOOL Press any key to continue….

Awards for schools iii)

Back to menu When the user choose ‘back to menu’, the program will go back to the main menu.

30


Design - Project Specification

7.

Editing entry After choosing ‘edit entry’, the program will ask the user to enter the id of the students. Then, the program will show another menu which contains another six options.

Edit entry Please enter the id: Ask for id Edit entry

1. 2. 3. 4. 5. 6.

Name Sex Age Answer School code Back to menu Edit entry menu

i)

Name When the user chooses ‘name’, the program will changed the name of the student with chosen-id.

Edit entry Please enter the new name:

31


Design - Project Specification

Edit by name ii)

Sex When the user chooses ‘sex’, the program will change the sex of the student with chosen-id.

Edit entry Please enter the new sex: Edit by sex iii)

Age When the user chooses ‘age’, the program will changed the age of the student with chosen-id.

Edit entry Please enter the new age: Edit by age iv)

Answer When the user chooses ‘answer’, the program will changed the answer of the student with chosen-id.

Edit entry Please enter the new answer: Edit by answer

32


Design - Project Specification

v)

School code When the user chooses ‘school code’, the program will changed the school code of the student with chosen-id.

Edit entry Please enter the new school code: Edit by school code vi)

Back to menu When the user choose ‘back to menu’, the program will go back to the main menu.

8.

Output Report After choosing ‘output report’, the program will show a statement “Report has been saved to ‘Report.txt’…” and it will ask the user to press any key to continue.

Output report

Report has been saved to ‘Report.txt’ … Press any key to continue…. Output report 9.

Exit After choosing ‘exit’, the program will end.

33


Design - Operation rules

1.

For inputting file pathway The format should be at this way “drive:\filename\” For example: C:\coursework\ Remember that all the filenames should be in English. If the pathway of file is not correct, the window will be closed.

2.

To Control the menu Users can only use the arrow key ↑and↓to control the movement of the pointer so as to choice the item they want by pressing Enter key only.

3.

For the input of search by name Remember all the input of student names should be capital latter. For example: CHAN TAI MAN

4.

For the input of search by id and ranking Remember that all student id and ranking should be within the total number of students while that of school id should be within the total number of school.

5. For filtering Users can choose filtering the data by sex, age, school, mark and ranking. They can filter the data out by inputting the desire condition For example: if he wants to find out all the students’ result from one school, they can filter by inputting the school no.

34


Design - Operation rules

The filtering function is different from the searching function because filtering can find out all the data from a wide range of condition but searching is only for finding out one specific entry. 6. Output of report The report will be outputted in the same directory of the exe file. And the output is a text file named “report.txt�.

35


Design - Program flow chart

Start

Input path of data files.

Read Data

Calculation mark of candidates & school

Sorting marks of candidate and school.

Distribute the awards

Filter by age

according to ranking. Data found

Filter by sex Display main menu Filter by marks Show Individual

Filtering Entry

Filter by school

entry. Output to “Report.tx Show student report

Awards of

Output Report

Show entry

Show report Quit Program

Searching Entry

Awards

Data found

Show school report

Filter by ranking

Search by name

Edit Entry

Search by id

Students Search by rank

Input id for editing Awards of Schools Edit name

Edit sex

Edit age

Edit answer

Edit school

End

36


Design - Implementation

1. Samples

Fig1. Input of path of the database and the loading screen Description: When user opens the executable file, he will be asked to input the path of the data file so that the program can read the file from the directory inputted. If the user input a wrong path then the program cannot be run and shut down automatically.

37


Design - Implementation

Fig2. The main menu of the program

Fig3. The arrow key and enter key to control the menu Description: After the loading screen, the user will enter the main menu. In the main menu, all the functions of the program are listed (As shown in Fig2). User can choose their option by pressing the arrow key on the keyboard, and then the highlighted word will be change press by press. After choosing the desire item, user can press the enter key to run that procedure.

38


Design - Implementation

Fig4. The screen of showing individual data

Fig5. Show the key on the keyboard that user will use Description: When the users choose show individual data, the screen above will be shown. The name, sex, age, school, answer, marks and ranking will be shown. The checking is for let the user to see which questions he/she got incorrect. Moreover, the bar besides the ranking shows the position of the student in the whole competition. If the user presses ‘SPACE’ key then next entry will be shown. If the user presses ‘E’ then he can edit the entry he chosen. Last, if the user press Esc then ,it will return to the main menu.

39


Design - Implementation

Fig6. Search Entry and its options Description: When the users choose search entry, the screen above will be shown. User can search data in three ways: search by name, search by id, and search by ranking. After choosing an option, you will be asked to enter the data for searching. If no data is found, the screen below will be shown and then back to the searching menu.

Fig7. No Data Found

40


Design - Implementation

Fig8. The menu of filtering entry

Description: After the user choosing filtering entry. The menu and the function of filtering entries are more less the same to the searching entry. User can filter data by their sex, age, school, mark and ranking. If the user input M in the filter by sex, then all the male data will be shown without showing any entries from female. This function is more useful than searching when doing analysis as we can see the difference between groups of candidates. Moreover, filtering data can let us find the party which can satisfy some special condition but searching is just finding out the desire one.

41


Design - Implementation

Fig9. Displaying different kind of data. Description: When the user chooses display report. The user can choose which report he wants to read: candidates analysis, school analysis and question analysis. So that he can see though the competition completely by different approach. And the screens above show the program using graphical method to represent the data instead of only numerical data which is more easy to compare the data.

42


Design - Implementation

Fig10. Showing the awards

Description:

Awards are an important of a competition. Therefore, user can see

which individual students and which school gets the price after choosing awards. The awards giving is calculated by the mark they get and the ranking. And the top 10 student can get prices and the top 10 school can also get the prices. As shown above, the awards are: gold award, silver award, bronze award and Honorable Mentions. The marks and the ranking will be calculate automatically right after reading the database, therefore, no calculation work is need to do by the users themselves to find out which team get the awards.

43


Design - Implementation

Fig11. Editing data

Description: User can also edit the data if they find any mistake. What they need to do is to enter the id of the candidate who they want to edit. Then they can edit the name, sex, age, answer and belonging school of the candidate. They can edit they data in the following ways:

44


Design - Implementation

\\\

Fig12. Output of the report Description: After the user chooses output of Report, then “Report.txt� will be built in the same directory of the exe file. The report includes all the data about the

45


Design - Implementation

competition and the analysis of the candidates, schools and questions. You can have further detail by the sample of report found in the appendix.

2. Program Listing Files Structure: z

Main.pas ( The source code of the whole program)

z

Random.pas ( The source of the program to randomize all the data)

z

Student.txt ( All the data about the candidates)

z

School.txt ( All the data about the school)

z

Data.txt ( The data collected after the competition)

z

Report.txt ( The written output of the program)

Database Structure: Table: Student Field

Size

Data type

ID (keyfield)

3

Integer

Name

255

String

Answer

50

String

Age

2

Integer

Sex

1

Char

School_no

2

Integer

Mark

2

Integer

Ranking

3

integer

Field

Size

Data type

ID (keyfield)

3

Integer

Name

255

String

No_of_student

50

String

Ranking

3

integer

Table: School

46


Design - Implementation

File: Data.txt Description: This file contains all the answers of each student and the first line is the model answer. BDCDABDBDDDDCDCDAAACDDCAAADBBDACDDDBCDABAADCBDDCDD 1 BDADDBDBADBACDCDABABDDDAAADBBDACDCDBBBABCADCBADCDD 2 BDCDABDBDDDBCDDDAADCDDCAAADBCDBCDDCBCDABADDCCDDCDD 3 BDCDABBBCCDCCDCDAAACDDCAAADDBBCCDDDBCDABCADCBDDCDD 4 BDCDBBDBDDCDCDCDAAACDBCADAAABDACBDDBCDABABDCADDCDD 5 CDCDABDBCDBDCDCCBABCADCAAADCBDACADDBCDABAADCBDBCDD 6 BDCDADDADDDDADBBAAACBCCAAACBBDACDDABCCABAAACBDCCDD 7 BDCDABDBDDDDCDADABACDCCADCDBDDACDCCBADABAABCBDDCDD 8 BDBDABDAADDDCDCCAAACDDCAAAABCCDCCDDBCDBCCADCCDDDDD 9 BDCDABDBDDDDCDCDAAACDDCADADBBDACDDDBCCCBAADCBDDCDD 10 BDCDABDBBADDADCDDAACDCCAAADBBDACDDDBCDCBCACABADCDA 11 BDCDABABDDDDCDCDAAACDDBAAADBBDACDDDBCDABAADCBDACDD 12 BDCAABDBDDDDCDCDBABCDDCAAABBBDACDDDBCDABAADCBBDCCD

. . . . . . . .

47


Design - Implementation

172 BDCDABDBDDDDCDCAAACCDDCAAADBBDACDDDBCDABAADBBDDCAD File:

Student.txt

Description: This file contains all data of each student, the format is like this: -

ID

-

Name

-

Age

-

School

1 CHAN CHUN MAN 18 M 2 2 CHAN PING CHUN 16 F 10 3 CHAN SHUK YAN 19 F 20

. . . . . . . 171 YU SAU CHU 19 M 3 172 YUM POU MAN 18

48


Design - Implementation

F 14 File: School.txt Description: This file contains all name of the schools. CUHKFAA CHAN CHUN HA SECONDARY SCHOOL GCC&ITKD LAU PAK LOK SECONDARY SCHOOL HELEN LIANG MEMORIAL SECONDARY SCHOOL (SHATIN) K & KLN CCPA MA CHUNG SUM SECONDARY SCHOOL HKBU AFFILIATED SCHOOL WONG KAM FAI SECONDARY HKCWC FUNG YIU KING MEMORIAL SECONDARY SCHOOL IMMACULATE HEART OF MARY COLLEGE JOCKEY CLUB TI-I COLLEGE KIANGSU-CHEKIANG COLLEGE (SHATIN) KWOK TAK SENG CATHOLIC SECONDARY SCHOOL LAM TAI FAI COLLEGE LOCK TAO SECONDARY SCHOOL LOK SIN TONG YOUNG KO HSIAO LIN SECONDARY SCHOOL MA ON SHAN ST JOSEPH'S SECONDARY SCHOOL MA ON SHAN TSUNG TSIN SECONDARY SCHOOL NG YUK SECONDARY SCHOOL PENTECOSTAL LAM HON KWONG SCHOOL PO LEUNG KUK C W CHU COLLEGE PO LEUNG KUK WU CHUNG COLLEGE POH CHAN KAI MEMORIAL COLLEGE

49


Design - Implementation

File: Random.pas Description: This file contains all name of the schools. 10.

Program random_student;

11.

uses crt;

12.

Var

13.

filein : text;

14.

name : Array[1..172] of string;

15.

i,j,k,no : integer;

16.

path : string;

17.

ans : string;

18.

temp : string;

19.

Begin

20.

Write('Path of the database : ');

21.

Readln(path);

22.

Write('How many entries do you want? ');

23.

readln(no);

24.

Assign(filein,path+'Student_name.txt');

25.

reset(filein);

26.

for i := 1 to no do

27.

readln(filein,name[i]);

28.

close(filein);

29.

Assign(filein,path+'Student.txt');

30.

rewrite(filein);

31.

randomize;

32.

for i := 1 to no do

33.

Begin

34.

writeln(filein,i);

35.

writeln(filein,name[i]);

36.

writeln(filein,random(4)+16);

37.

j := random(2)+1;

38.

Case j of

39.

1 : writeln(filein,'M');

40.

2 : writeln(filein,'F');

41.

End;

42.

writeln(filein,random(20)+1);

50


Design - Implementation

End;

43. 44.

close(filein);

45.

Assign(filein,path+'data.txt');

46.

rewrite(filein);

47.

ans := '';

48.

for i := 1 to 50 do Begin

49. 50.

k := random(4)+1;

51.

Case

k of

52.

1: ans:= ans+'A';

53.

2: ans:= ans+'B';

54.

3: ans:= ans+'C';

55.

4: ans:= ans+'D'; End;

56. End;

57. 58.

writeln(filein,ans);

59.

for i := 1 to no do Begin

60. 61.

writeln(filein,i);

62.

temp := ans;

63.

For j := 1 to random(25)+5 do Begin

64.

k := random(4)+1;

65.

Case

66.

k of

67.

1: temp[random(50)+1] := 'A';

68.

2: temp[random(50)+1] := 'B';

69.

3: temp[random(50)+1] := 'C';

70.

4: temp[random(50)+1] := 'D'; End;

71. End;

72.

writeln(filein,temp);

73. 74.

End;

75.

Close(filein);

76. 77.

End.

51


Design - Implementation

File: Random.pas Description: This file contains all name of the schools. 1.

Program CIT_Coursework;

2.

Uses

3. 4.

Crt; Const

5.

Max_No_of_School= 20;

6.

Max_No_of_Student = 200;

7.

Type

8.

Student = Record

9.

id : integer;

10.

name : string;

11.

ans : string;

12.

age : integer;

13.

sex : char;

14.

school_no : integer;

15.

mark : integer;

16.

ranking : integer;

17.

End;

18.

School = Record

19.

name : string;

20.

id : integer;

21.

no_of_student : integer;

22.

total_mark : integer;

23.

ranking : integer;

24. 25.

End; Var

26.

Student_data : Array[1..Max_No_of_Student] of Student;

27.

School_data : Array[1..Max_No_of_School] of School;

28.

show_data : Array[1..Max_No_of_Student] of Student;

29.

header : Array[1..20] of String;

30.

menu_length

31.

menu_string : Array[1..20,1..20] of String;

32.

Answer : String;

33.

total_School,total_Student,choice: Integer;

: Array[1..10] of integer;

52


Design - Implementation

34.

path : String;

Form line 1 to 34 is for declaring variables. 35.

Procedure welcome;

36.

var

37. 38.

i : integer; Begin

39.

For i := 1 to 12 do

40.

Writeln;

41.

Write('':20,'Path of the database : ');

42.

Readln(path);

43.

Clrscr;

44.

For i := 1 to 9 do

45.

Writeln;

46.

TEXTCOLOR(14);

47.

Writeln('':30,'Reading Database...');

48.

Writeln;

49.

write('':15);

50.

For i := 1 to 50 do

51.

Begin

52.

TextBackGround(4);

53.

delay(50);

54.

write(' ');

55. 56.

End; End;

For line 35 to 42 is for reading the path of the program. From 44 to 56 showing the bar which indicates the process of reading path. 57. 58.

Procedure Input_data; Var

59.

id,i : integer;

60.

filein : text;

61.

Begin

62.

total_Student := 0;

63.

total_School := 0;

64.

Assign(filein,path+'Student.txt');

65.

Reset(filein);

66.

While not eof(filein) do

67.

Begin

53


Design - Implementation

68.

Readln(filein,id);

69.

Student_data[id].id := id;

70.

Readln(filein,Student_data[id].name);

71.

Readln(filein,Student_data[id].age);

72.

Readln(filein,Student_data[id].sex);

73.

Readln(filein,Student_data[id].school_no);

74.

total_Student := total_Student+1;

75.

End;

76.

Close(filein);

77.

Assign(filein,path+'School.txt');

78.

Reset(filein);

79.

id :=1;

80.

While not eof(filein) do

81.

Begin

82.

School_data[id].id := id;

83.

Readln(filein,School_data[id].name);

84.

id := id+1;

85.

total_School := total_School+1;

86.

End;

87.

Close(filein);

88.

Assign(filein,path+'data.txt');

89.

Reset(filein);

90.

Readln(filein,Answer);

91.

While not eof(filein) do

92.

Begin

93.

Readln(filein,id);

94.

Readln(filein,Student_data[id].ans);

95.

End;

96.

Close(filein);

97.

For i := 1 to total_School do

98.

Begin

99.

School_data[i].total_mark := 0;

100.

School_data[i].ranking := 0;

101.

School_data[i].no_of_student := 0;

102. 103. 104.

End; For i := 1 to total_Student do School_data[Student_data[i].school_no].no_of_student :=

54


Design - Implementation

105. School_data[Student_data[i].school_no].no_of_student + 1; 106.

End; From line 57 to 106 is for reading data for the files.

107. Procedure Check_ans; 108.

Var

109.

pos : Array[1..200,1..2] of integer;

110.

n,i,j,temp1 : integer;

111.

mark : integer;

112.

Begin

113.

n:= length(Answer);

114.

For i := 1 to total_Student do

115.

Begin

116.

mark := 0;

117.

For j := 1 to n do

118. 119.

If Student_data[i].ans[j] = Answer[j] then mark:= mark+1;

120. 121. 122. 123.

Student_data[i].mark := mark; End; For i := 1 to total_Student do School_data[Student_data[i].school_no].total_mark :=

124. School_data[Student_data[i].school_no].total_mark+ Student_data[i].mark; 125. 126.

For i := 1 to total_Student do Begin

127.

pos[i,1] := Student_data[i].mark;

128.

pos[i,2] := Student_data[i].id;

129. 130. 131.

End; For i := total_Student-1 DownTo 1 do Begin

132.

For j := 1 to i do

133.

Begin

134.

If (pos[j-1,1] < pos[j,1]) then

135.

Begin

136.

temp1 := pos[j-1,1];

137.

pos[j-1,1] := pos[j,1];

138.

pos[j,1] := temp1;

139.

temp1 := pos[j-1,2];

140.

pos[j-1,2] := pos[j,2];

55


Design - Implementation

141.

pos[j,2] := temp1;

142.

End;

143.

End;

144.

End;

145.

For i := 1 to total_Student do

146.

Student_data[pos[i,2]].ranking := i;

147.

For i := 1 to total_School do

148.

Begin

149.

pos[i,1] := School_data[i].total_mark;

150.

pos[i,2] := i;

151.

End;

152.

For i := total_School-1 DownTo 1 do

153.

Begin

154.

For j := 2 to i do

155.

Begin

156.

If (pos[j-1,1] < pos[j,1]) then

157.

Begin

158.

temp1 := pos[j-1,1];

159.

pos[j-1,1] := pos[j,1];

160.

pos[j,1] := temp1;

161.

temp1 := pos[j-1,2];

162.

pos[j-1,2] := pos[j,2];

163.

pos[j,2] := temp1;

164.

End;

165.

End;

166.

End;

167.

For i := 1 to total_School do

168. 169.

School_data[pos[i,2]].ranking := i; End;

From line 107 to 169 is for checking the answers of students. 170. Procedure initial; 171. Begin 172.

TextBackground(1);

173.

TextColor(14);

174.

Input_data;

175.

Check_ans;

176.

choice := 1;

56


Design - Implementation

177.

menu_length[1] := 8;

178.

menu_length[3] := 4;

179.

menu_length[4] := 6;

180.

menu_length[5] := 3;

181.

menu_length[6] := 3;

182.

menu_length[7] := 4;

183.

menu_length[10] := 6;

184.

header[1] := 'Welcome to the Multiple-Choice Analyzer';

185.

header[2] := '

186.

header[3] := '

Search Entry

187.

header[4] := '

Filter Entry

188.

header[5] := '

189.

header[6] := '

Add/Edit Entry

';

190.

header[7] := '

Display Report

';

191.

header[8] := '

Output Report

';

192.

header[10] := '

Edit Entry

Show individual data

'; '; ';

Awards

193.

menu_string[1,1] := 'Show invidual entry';

194.

menu_string[1,2] := 'Search entry';

195.

menu_string[1,3] := 'Filter entry';

196.

menu_string[1,4] := 'Display Report';

197.

menu_string[1,5] := 'Awards';

198.

menu_string[1,6] := 'Edit entry';

199.

menu_string[1,7] := 'Output Report';

200.

menu_string[1,8] := 'Exit';

201.

menu_string[3,1] := 'Search by name';

202.

menu_string[3,2] := 'Search by id';

203.

menu_string[3,3] := 'Search by ranking';

204.

menu_string[3,4] := 'Back to menu';

205.

menu_string[4,1] := 'Filter by Sex';

206.

menu_string[4,2] := 'Filter by Age';

207.

menu_String[4,3] := 'Filter by School';

208.

menu_String[4,4] := 'Filter by mark';

209.

menu_String[4,5] := 'Filter by ranking';

210.

menu_String[4,6] := 'Back to menu';

211.

menu_string[5,1] := 'Awards for students';

212.

menu_string[5,2] := 'Awards for schools';

213.

menu_string[5,3] := 'Back to menu';

';

';

57


Design - Implementation

214.

menu_string[7,1] := 'Candidates Analysis';

215.

menu_string[7,2] := 'Schools Analysis';

216.

menu_string[7,3] := 'Questions Analysis';

217.

menu_string[7,4] := 'Back to menu';

218.

menu_string[10,1] := 'Name';

219.

menu_string[10,2] := 'Sex';

220.

menu_string[10,3] := 'Age';

221.

menu_string[10,4] := 'Answer';

222.

menu_string[10,5] := 'School Code.';

223.

menu_string[10,6] := 'Back to menu';

224. End; From line 170 to 173 is for setting the text color and background color. From line 174 to 175 is for calling the procedures input_data and check_ans. From line 176 to 224 is for making the menus. 225. Procedure show_header( mode :integer ); 226. Begin 227.

Clrscr;

228.

Writeln('==============================================

229. ==============================='); 230.

Writeln('*

231. 232.

*'); Writeln('*

',header[mode]:39,'

233. *'); 234.

Writeln('*

235. 236.

*'); Writeln('==============================================

237. ==============================='); 238.

Writeln('

239.

');

240. End; From line 225 to 240 is for showing the header. 241. Procedure show_menu( mode,temp_choice : integer ); 242. Var 243.

i : integer;

244. Begin 245.

show_header(mode);

58


Design - Implementation

246.

For i := 1 to menu_length[mode] do

247.

Begin

248.

if temp_choice = i then TextColor(10);

249.

Writeln('

',i,'.

250. ',menu_string[mode,i]); 251.

TextColor(14);

252.

End;

253. End; 254. function read_key( mode : integer ) :integer; 255. Var 256.

temp_choice : integer;

257.

key : char;

258. Begin 259.

temp_choice := 1;

260.

Repeat

261.

show_menu(mode,temp_choice);

262.

key := readkey;

263.

Case key of

264.

'H' : Begin

265.

if temp_choice = 1 then temp_choice :=

266. menu_length[mode] 267.

else if temp_choice >1 then temp_choice :=

268. temp_choice -1; 269. 270.

End; 'P' : Begin

271.

if temp_choice = menu_length[mode] then

272. temp_choice := 1 273.

else if temp_choice < menu_length[mode] then

274. temp_choice := temp_choice +1; 275.

End;

276.

End;

277.

Until key = chr(13);

278.

read_key := temp_choice;

279. End; From line 241 to 279 is for showing the menu by reading the key input by the user. 280. Procedure EDIT_ENTRY ( mode : integer );

59


Design - Implementation

281. Var 282.

temp_key,temp_key1,id,i : integer;

283.

new_name : string;

284.

new_sex : char;

285.

temp_key2 : char;

286.

new_data : integer;

287.

new_ans : string[50];

288. Begin 289.

Begin

290.

Clrscr;

291.

if mode = 0 then

292.

Begin

293.

show_header(10);

294.

Writeln;

295.

Write('Please Enter the id : ':50);

296.

Readln(id);

297.

End Else

298. 299.

id := mode; Repeat

300.

show_menu(10,1);

301.

temp_key1 := read_key(10);

302.

Case temp_key1 of

303.

1: Begin

304.

show_header(10);

305.

writeln(id);

306.

Writeln;

307.

Write('Please enter the new name : ':40);

308.

Readln(new_name);

309.

Student_data[id].name := new_name;

310.

Clrscr;

311.

show_header(10);

312.

writeln;writeln;

313.

Writeln('Data Edited!':45);

314.

Writeln;

315.

Writeln;

316.

Writeln('Press any key to continue....':55);

317.

repeat until keypressed;

60


Design - Implementation

318.

temp_key2:=readkey;

319.

End;

320.

2: Begin

321.

show_header(10);

322.

Writeln;

323.

Write('Please enter the new Sex : ':40);

324.

Readln(new_sex);

325.

Student_data[id].sex := new_sex;

326.

Clrscr;

327.

show_header(10);

328.

writeln;writeln;

329.

Writeln('Data Edited!':45);

330.

Writeln;

331.

Writeln;

332.

Writeln('Press any key to continue....':55);

333.

repeat until keypressed;

334.

temp_key2:=readkey;

335. 336.

End; 3: Begin

337.

show_header(10);

338.

Writeln;

339.

Write('Please enter the new Age : ':40);

340.

Readln(new_data);

341.

Student_data[id].age := new_data;

342.

Clrscr;

343.

show_header(10);

344.

writeln;writeln;

345.

Writeln('Data Edited!':45);

346.

Writeln;

347.

Writeln;

348.

Writeln('Press any key to continue....':55);

349.

repeat until keypressed;

350.

temp_key2:=readkey;

351. 352.

End; 4: Begin

353.

show_header(10);

354.

Writeln;

61


Design - Implementation

355.

Write('Please enter the new Answer : ':40);

356.

Readln(new_ans);

357.

Student_data[id].ans := new_ans;

358.

Clrscr;

359.

show_header(10);

360.

writeln;writeln;

361.

Writeln('Data Edited!':45);

362.

Writeln;

363.

Writeln;

364.

Writeln('Press any key to continue....':55);

365.

repeat until keypressed;

366.

temp_key2:=readkey;

367.

End;

368.

5: Begin

369.

show_header(10);

370.

Writeln;

371.

Write('Please enter the new Shool code : ':40);

372.

Readln(new_data);

373.

Student_data[id].school_no := new_data;

374.

Clrscr;

375.

show_header(10);

376.

writeln;writeln;

377.

Writeln('Data Edited!':45);

378.

Writeln;

379.

Writeln;

380.

Writeln('Press any key to continue....':55);

381.

repeat until keypressed;

382.

temp_key2:=readkey;

383.

End;

384.

End;

385.

until temp_key1 = 6;

386.

Check_ans;

387.

For i := 1 to total_student do

388. 389.

show_data[i] := student_data[show_data[i].id]; End;

390. End; From line 287 to 298 is for asking the ID of the participant whom the user wants to

62


Design - Implementation

edit. From line 299 to 385 is for editing the entry of participant by name, sex, age, school and answer by repeat until loop. Line 386 is for calling the procedure Check_ans. From line 387 to 390 is for showing the entry. 391. Procedure show_entry( no_of_entry : integer ); 392. Var 393.

i,j : integer;

394.

key : char;

395. Begin 396.

i := 1;

397.

Repeat

398.

clrscr;

399.

show_header(2);

400.

writeln;

401.

TEXTCOLOR(10);

402.

Writeln('

403.

TEXTCOLOR(11);

404.

Writeln('

405.

TEXTCOLOR(12);

406.

Writeln('

407.

TEXTCOLOR(13);

408.

Writeln('

Name : ',show_data[i].name); Sex : ',show_data[i].sex); Age : ',show_data[i].age); School :

409. ',School_data[show_data[i].school_no].name); 410.

TEXTCOLOR(15);

411.

Writeln('

412.

Write('

413.

For j := 1 to length(Answer) do

414.

Answer : ',show_data[i].ans); Checking : ');

if show_data[i].ans[j] = Answer[j] then write('O')

415.

else Begin TEXTCOLOR(12);write('X'); TEXTCOLOR(15);

416. End; 417.

Writeln;

418.

TEXTCOLOR(10);

419.

Writeln('

420.

TEXTCOLOR(11);

421.

Write('

422.

TextBackground(10);

423.

For j := 1 to round (40 * (show_data[i].ranking / total_Student)) do

424.

Marks : ',show_data[i].mark); Raking : ',show_data[i].ranking:3,' [');

write(' ');

63


Design - Implementation

425.

TextBackground(1);

426.

For j := 1 to 40 - round( 40 * (show_data[i].ranking / total_Student)) do

427.

write(' ');

428.

write(']');

429.

TEXTCOLOR(14);

430.

Writeln;

431.

Writeln;

432.

Writeln;

433.

Writeln('================================

434. ',i:3,'/',no_of_entry,' ===================================='); 435.

Writeln;

436.

TEXTCOLOR(12);

437.

Writeln('

438.

Press ''E'' to edit this entry');

TEXTCOLOR(10);

439.

Writeln('

440.

Press SPACE to the next page');

TEXTCOLOR(15);

441.

Writeln('

442.

Press Esc to Exit ');

TEXTCOLOR(14);

443.

key := readkey;

444.

if (key = ' ') and (i < no_of_entry )then i := i +1

445.

else if ((key = 'e' )or(key = 'E')) then EDIT_ENTRY(show_data[i].id);

446.

Until (key = chr(27));

447. End; From line 391 to 428 is for showing the individual entry of each participant. From line 429 to 447 is for instructing the user to press ‘E’ to edit entry, SPACE bar to enter next page and ESC to exit. 448. Procedure Searching_Data( mode : integer ); 449. Var i : integer; 450.

search_name : string;

451.

search_id,search_ranking : integer;

452.

flag : boolean;

453.

temp_key : char;

454. Begin 455.

Clrscr;

456.

show_header(3);

457.

writeln;

458.

Case

mode of

64


Design - Implementation

459.

1 : Begin

460.

write('

461.

readln(search_name);

462.

End;

463.

2 : Begin

464.

write('

465.

Repeat

466.

Please enter the name for searching : ');

Please enter the ID for searching : ');

read(search_id);

467.

until (search_id >= 1) and (search_id <= total_student);

468.

End;

469.

3:

Begin

470.

write('

Please enter the ranking for searching :

471. '); 472.

Repeat

473.

read(search_ranking);

474.

until (search_ranking >= 1) and (search_ranking <=

475. total_student); 476.

End;

477.

End;

478.

If mode = 2 then

479.

Begin

480.

show_data[1] := student_data[search_id];

481.

Clrscr;

482.

show_entry(1);

483.

End;

484.

If mode <>2 then

485.

Begin

486.

flag := FALSE ;

487.

For i := 1 to total_student do

488. 489.

Begin if (Student_data[i].name = search_name)and(mode = 1)

490. then 491.

Begin

492.

show_data[1] := student_data[i];

493.

flag := TRUE;

494. 495.

End; if (Student_data[i].ranking = search_ranking)and(mode =

65


Design - Implementation

496. 3) then 497.

Begin

498.

show_data[1] := student_data[i];

499.

flag := TRUE;

500.

End;

501.

End;

502.

If flag = TRUE then

503.

Begin

504.

Clrscr;

505.

show_entry(1);

506.

End

507.

Else Begin

508.

Clrscr;

509.

show_header(10);

510.

writeln;

511.

writeln;

512.

Writeln('Sorry! No Data Found !':50);

513.

Writeln;

514.

Writeln;

515.

Writeln('Press any key to continue....':55);

516.

repeat until keypressed ;

517.

temp_key := readkey;

518.

End;

519.

End;

520. End; 521. Procedure Searching; 522. Var 523.

temp_key : integer;

524. Begin 525.

Repeat

526.

show_menu(3,1);

527.

temp_key := read_key(3);

528.

Case temp_key of

529.

1 : Searching_Data(1);

530.

2 : Searching_Data(2);

531.

3 : Searching_Data(3);

532.

End;

66


Design - Implementation

533.

until temp_key = 4;

534. End; From line 448 to 534 is for searching entry by different ways such as name, ID, ranking, etc. 535. Procedure filtering; 536. Var 537.

temp_key,i,n,age,school,flag,mark,ranking : integer;

538.

sex,eat_key : char;

539. Begin 540.

Repeat

541.

show_menu(4,1);

542.

temp_key := read_key(4);

543.

Case temp_key of

544.

1 : Begin

545.

Clrscr;

546.

show_header(4);

547.

writeln;

548.

write('Please select M/F : ':50);

549.

repeat

550. 551.

read(sex); until (sex = 'm') or( sex ='M') or (sex = 'f') or (sex

552. ='F'); 553.

if sex = 'm' then sex := 'M';

554.

if sex = 'f' then sex := 'F';

555.

n:=0;

556.

For i := 1 to total_student do

557.

if Student_data[i].sex = sex then

558.

Begin

559.

n:=n+1;

560.

show_data[n] := student_data[i];

561.

End;

562.

Clrscr;

563.

if n > 0 then show_entry(n)

564.

else Begin

565.

show_header(4);

566.

writeln;

567.

writeln('No Data Found!':47);

67


Design - Implementation

568.

Writeln;

569.

Writeln;

570.

Writeln('Press any key to continue....':55);

571.

repeat until keypressed;

572.

eat_key := readkey;

573.

End;

574.

End;

575.

2 : Begin

576.

Clrscr;

577.

show_header(4);

578.

writeln;

579.

write('Please input the age : ': 40);

580.

read(age);

581.

n:=0;

582.

For i := 1 to total_student do

583.

if age = Student_data[i].age then

584.

Begin

585.

n:=n+1;

586.

show_data[n] := student_data[i];

587.

End;

588.

Clrscr;

589.

if n > 0 then show_entry(n)

590.

else Begin

591.

show_header(4);

592.

writeln;

593.

writeln('No Data Found!':47);

594.

Writeln;

595.

Writeln;

596.

Writeln('Press any key to continue....':55);

597.

repeat until keypressed;

598.

eat_key := readkey;

599.

End;

600.

End;

601.

3 : Begin

602.

Clrscr;

603.

show_header(4);

604.

writeln;

68


Design - Implementation

605.

write('Please input the School code : ':40);

606.

read(school);

607.

n:=0;

608.

For i := 1 to total_student do

609.

if Student_data[i].school_no = school then

610.

Begin

611.

n:=n+1;

612.

show_data[n] := student_data[i];

613.

End;

614.

Clrscr;

615.

if n > 0 then show_entry(n)

616.

else Begin

617.

show_header(4);

618.

writeln;

619.

writeln('No Data Found!':47);

620.

Writeln;

621.

Writeln;

622.

Writeln('Press any key to continue....':55);

623.

repeat until keypressed;

624.

eat_key := readkey;

625.

End;

626.

End;

627.

4 : Begin

628.

Clrscr;

629.

show_header(4);

630.

writeln;

631.

write('Please input the mark : ':40);

632.

read(mark);

633.

writeln;

634.

write('

Greater(1) or smaller(2) then ',mark:2,' :

635. '); 636.

repeat read(flag) until (flag = 1) or (flag = 2);

637.

n:=0;

638.

For i := 1 to total_student do

639.

if ((Student_data[i].mark >= mark)and(flag = 1))

640. or ((Student_data[i].mark <= mark)and(flag = 2)) then 641.

Begin

69


Design - Implementation

642.

n:=n+1;

643.

show_data[n] := student_data[i];

644.

End;

645.

Clrscr;

646.

if n > 0 then show_entry(n)

647.

else Begin

648.

show_header(4);

649.

writeln;

650.

writeln('No Data Found!':47);

651.

Writeln;

652.

Writeln;

653.

Writeln('Press any key to continue....':55);

654.

repeat until keypressed;

655.

eat_key := readkey;

656.

End;

657.

End;

658.

5 : Begin

659.

Clrscr;

660.

show_header(4);

661.

writeln;

662.

write('Please input the ranking : ':40);

663.

read(ranking);

664.

writeln;

665.

write('

Greater(1) or smaller(2) then

666. ',ranking:2,' : '); 667.

repeat read(flag) until (flag = 1) or (flag = 2);

668.

n:=0;

669.

For i := 1 to total_student do

670.

if ((Student_data[i].ranking >= ranking)and(flag

671. = 1)) or ((Student_data[i].ranking <= ranking)and(flag = 2)) then 672.

Begin

673.

n:=n+1;

674.

show_data[n] := student_data[i];

675.

End;

676.

Clrscr;

677.

if n > 0 then show_entry(n)

70


Design - Implementation

678.

else Begin

679.

show_header(4);

680.

writeln;

681.

writeln('No Data Found!':47);

682.

Writeln;

683.

Writeln;

684.

Writeln('Press any key to continue....':55);

685.

repeat until keypressed;

686.

eat_key := readkey;

687.

End;

688.

End;

689. 690.

End; until temp_key = 6;

691. End; From line 535 to 690 is for filtering entry by sex, age, school, mark, ranking, etc. 692. Procedure award; 693. Var 694.

temp_key,i,j : integer;

695.

eat_key : char;

696. Begin 697.

Repeat

698.

show_menu(5,1);

699.

temp_key := read_key(5);

700.

Case temp_key of

701.

1:

Begin

702.

Clrscr;

703.

show_header(5);

704.

Writeln;

705.

Write('Gold award : ':40);

706.

for i := 1 to total_student do

707. 708.

if student_data[i].ranking = 1 then writeln(student_data[i].name);

709.

Write('Silver award : ':40);

710.

for i := 1 to total_student do

711. 712. 713.

if student_data[i].ranking = 2 then writeln(student_data[i].name); Write('Bronze award : ':40);

71


Design - Implementation

714.

for i := 1 to total_student do

715.

if student_data[i].ranking = 3

716.

then writeln(student_data[i].name);

717.

Write('Honorable Mentions

718.

: ':40);

for i := 1 to total_student do

719.

if student_data[i].ranking = 4

720.

then

721. writeln(student_data[i].name); 722.

for j := 5 to 10 do

723.

Begin

724.

write(' ':40);

725.

for i := 1 to total_student do

726.

if student_data[i].ranking = j

727.

then

728. writeln(student_data[i].name); 729.

End;

730.

Writeln;

731.

Writeln('Press any key to continue....':55);

732.

repeat until keypressed;

733.

eat_key := readkey;

734. 735.

End; 2:

Begin

736.

Clrscr;

737.

show_header(5);

738.

Writeln;

739.

Writeln('Gold award : ':30);

740.

for i := 1 to total_school do

741.

if school_data[i].ranking = 1

742.

then begin write('':25);

743. writeln(school_data[i].name);end; 744.

Writeln('Silver award : ':30);

745.

for i := 1 to total_school do

746.

if school_data[i].ranking = 2

747.

then begin write('':25); writeln(school_data[i].name);end;

748.

Writeln('Bronze award : ':30);

72


Design - Implementation

749.

for i := 1 to total_school do

750.

if school_data[i].ranking = 3

751.

then begin write('':25);

752. writeln(school_data[i].name);end; 753.

Writeln('Honorable Mentions

754.

for j := 4 to 10 do

755.

: ':30);

for i := 1 to total_school do

756.

if school_data[i].ranking = j

757.

then begin write('':25);

758. writeln(school_data[i].name);end; 759.

Writeln('Most participates : ':30);

760.

j := school_data[1].no_of_student;

761.

for i := 1 to total_school do

762.

if school_data[i].no_of_student > j then

763.

j:= school_data[i].no_of_student;

764.

for i := 1 to total_school do

765.

if school_data[i].no_of_student = j then

766.

begin write('':25);

767. writeln(school_data[i].name);end; 768.

Writeln;

769.

Writeln('Press any key to continue....':55);

770.

repeat until keypressed;

771.

eat_key := readkey;

772.

End;

773.

End;

774.

until temp_key = 3;

775. End; From line 692 to 774 is for showing the awards for the students and school. 776. Procedure reporting; 777. Var 778. 779. 780.

temp_key,i,j,k,male,female,temp_age,n,total_mark,entry_per_page,count : integer; eatkey : char;

781. Begin 782. 783.

Repeat show_menu(7,1);

73


Design - Implementation

784.

temp_key := read_key(7);

785.

Case temp_key of

786.

1 : Begin

787.

Clrscr;

788.

show_header(7);

789.

Writeln;

790.

Writeln('Total Candidate : ':40,total_student);

791.

Writeln('Total School : ':40,total_school);

792.

Writeln;

793.

male := 0;

794.

female := 0;

795.

For i := 1 to total_student do

796.

if student_data[i].sex = 'M' then

797.

male := male +1 else

798.

female := female +1;

799.

Write('Male : ':30,male:2,' ');

800.

TextBackGround(4);

801.

for i := 1 to round(50*(male/total_student)) do

802.

write(' ');

803.

TextBackGround(1);

804.

writeln;

805.

Write('Female : ':30,female:2,' ');

806.

TextBackGround(6);

807.

for i := 1 to round(50*(female/total_student)) do

808.

write(' ');

809.

TextBackGround(1);

810.

writeln;

811.

writeln;

812.

for j := 16 to 19 do

813.

begin

814.

temp_age := 0;

815.

for i := 1 to total_student do

816. 817.

if student_data[i].age = j then temp_age := temp_age +1;

818.

write('Age ':25,j,' : ',temp_age:2,' ');

819.

TextBackGround(4+j);

820.

for i := 1 to round(30*(temp_age/total_student))

74


Design - Implementation

821. do 822.

write(' ');

823.

writeln;

824.

TextBackGround(1);

825.

End;

826.

writeln;

827.

Writeln;

828.

Writeln('Press to Next Page...':45);

829.

repeat until keypressed;

830.

eatkey:=readkey;

831.

Clrscr;

832.

show_header(7);

833.

Writeln;

834.

Writeln('Top 10 Students : ':40);

835.

writeln;

836.

For i := 1 to 10 do

837.

For j := 1 to total_Student do

838.

if Student_data[j].ranking = i then

839.

writeln(i:30,'. ',Student_data[j].name);

840.

writeln;

841.

Writeln;

842.

Writeln('Press any key to continue....':55);

843.

repeat until keypressed;

844.

eatkey:=readkey;

845.

End;

846.

2 : Begin

847.

total_mark :=0;

848.

For i := 1 to total_school do

849.

total_mark := total_mark + School_data[i].total_mark;

850.

entry_per_page := 5;

851.

n := round(total_School/entry_per_page);

852.

For i := 1 to n do

853.

Begin

854.

Clrscr;

855.

show_header(7);

856.

For j := entry_per_page*(i-1)+1 to

857. entry_per_page*i do

75


Design - Implementation

858.

Begin

859.

Writeln('

860. ':20,School_data[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)].name); 861.

Write(' ':25,'Students :

862. ',School_data[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)].no_of_student:3, 863. ' '); 864.

TextBackGround(10);

865.

for k := 1 to

866. round(150*(School_data[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)].no_o 867. f_student/total_student)) do 868.

write(' ');

869.

TextBackGround(1);

870.

Writeln;

871.

Write(' ':28,'Marks :

872. ',School_data[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)].total_mark:3,' '); 873.

TextBackGround(7);

874.

for k := 1 to

875. round(150*(School_data[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)].total 876. _mark/total_mark)) do 877.

write(' ');

878.

TextBackGround(1);

879.

Writeln;

880.

End;

881.

Writeln;

882.

Writeln('':30,'

883.

repeat until keypressed;

884.

eatkey:=readkey;

885.

Page ',i,'/',n,'

');

End;

886.

End;

887.

3 : Begin

888.

entry_per_page := 8;

889.

n := round(length(Answer)/entry_per_page);

890.

For i := 1 to n do

891.

Begin

892.

Clrscr;

893.

show_header(7);

76


Design - Implementation

894.

For j := entry_per_page*(i-1)+1 to

895. entry_per_page*i do 896.

Begin

897.

count :=0;

898.

For k := 1 to total_student do

899.

if

900. student_data[k].ans[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)] = 901. Answer[(i-1)*entry_per_page+(j-(i-1)*entry_per_page)] 902.

then count := count+1;

903.

Write('':17,'Q',(i-1)*entry_per_page+(j-(i-1)*entry_per_page):2,'. |

904. Correct : ',count:2,' (',round((count/total_student)*100):2,'%) '); 905.

Randomize;

906.

TextBackGround(10+j*10+k);

907.

for k := 1 to round(30*(count/total_student))

908.

do

909.

write(' ');

910.

TextBackGround(1);

911.

Writeln;

912.

Writeln;

913.

End;

914.

Writeln;

915.

Writeln('':30,'

916.

repeat until keypressed;

917.

eatkey:=readkey;

918.

921.

');

End;

919. 920.

Page ',i,'/',n,'

End; End; until temp_key = 4;

922. End; From 776 to 922 is for analyzing the total no. of candidates, schools, gender, questions ,etc. 923. Procedure output_report; 924. Var 925.

fileout : text;

926.

i,j,count : integer;

927.

eatkey : char;

77


Design - Implementation

928. Begin 929.

Assign(fileout,path+'Report.txt');

930.

Rewrite(fileout);

931.

Writeln(fileout,'###############################################

932. ##############'); 933.

Writeln(fileout,'#

934.

#');

935.

Writeln(fileout,'#

936.

#');

937.

Writeln(fileout,'#

938. 939.

Analysis Report Generated by Program

#'); Writeln(fileout,'###############################################

940. ##############'); 941.

Writeln(fileout,'General Information:');

942.

Writeln(fileout,'1. Total Candidates : ',total_student);

943.

Writeln(fileout,'2. Total Schools : ',total_school);

944.

Writeln(fileout,'3. Total Questions : ',length(Answer));

945.

Writeln(fileout,'4. Model Answer :',Answer);

946.

Writeln(fileout,'###############################################

947. ##############'); 948.

Writeln(fileout,'Student Information:');

949.

Writeln(fileout);

950.

For i := 1 to total_student do

951.

Begin

952.

Writeln(fileout,'Name: ',Student_data[i].name);

953.

Writeln(fileout,'Age: ',Student_data[i].age);

954.

Writeln(fileout,'Sex: ',Student_data[i].sex);

955.

Writeln(fileout,'School:

956. ',School_data[Student_data[i].school_no].name); 957.

Writeln(fileout,'Answer: ',Student_data[i].ans);

958.

Writeln(fileout,'Marks: ',Student_data[i].mark);

959.

Writeln(fileout,'Ranking: ',Student_data[i].ranking);

960.

Writeln(fileout);

961.

End;

962.

Writeln(fileout,'###############################################

963. ##############');

78


Design - Implementation

964.

Writeln(fileout,'School Information:');

965.

Writeln(fileout);

966.

For i := 1 to total_school do

967.

Begin

968.

Writeln(fileout,'Name: ',school_data[i].name);

969.

Writeln(fileout,'No of Candidate: ',school_data[i].no_of_student);

970.

Writeln(fileout,'Total Marks: ',school_data[i].total_mark);

971.

Writeln(fileout,'Ranking: ',school_data[i].ranking);

972.

Writeln(fileout);

973.

End;

974.

Writeln(fileout,'###############################################

975. ###############'); 976.

Writeln(fileout,'Special Analysis:');

977.

Writeln(fileout);

978.

count := 0;

979.

For i := 1 to total_student do

980.

if student_data[i].sex = 'M' then count := count+1;

981.

Writeln(fileout,' Total Male Candidate: ',count);

982.

count := 0;

983.

For i := 1 to total_student do

984.

if student_data[i].sex = 'F' then count := count+1;

985.

Writeln(fileout,'Total Female Candidate: ',count);

986.

Writeln(fileout);

987.

For j := 16 to 19 do

988.

Begin

989.

count := 0;

990.

For i := 1 to total_student do

991.

if student_data[i].age = j then count := count+1;

992. 993.

Writeln(fileout,'Age of ',j,': ',count); End;

994.

Writeln(fileout);

995.

Writeln(fileout,'TOP 10 Students:');

996.

Writeln(fileout);

997.

For i := 1 to 10 do

998. 999. 1000.

Begin For j := 1 to total_student do if student_data[j].ranking = i then

79


Design - Implementation

1001. 1002.

writeln(fileout,i,'. ',student_data[j].name); End;

1003.

Writeln(fileout);

1004.

Writeln(fileout,'TOP 10 Schools:');

1005.

Writeln(fileout);

1006.

For i := 1 to 10 do

1007.

Begin

1008.

For j := 1 to total_school do

1009.

if school_data[j].ranking = i then

1010. 1011.

writeln(fileout,i,'. ',school_data[j].name); End;

1012.

Writeln(fileout);

1013.

Writeln(fileout,'###############################################

1014. ###############'); 1015.

Writeln(fileout,'Question Analysis:');

1016.

For i := 1 to length(Answer) do

1017.

Begin

1018.

count := 0;

1019.

For j := 1 to total_student do

1020.

if student_data[j].ans[i] = Answer[i] then count := count

1021. +1; 1022.

Writeln(fileout,'Q',i:2,'. | Correct : ',count,'

1023. (',round((count/total_student)*100),'%)'); 1024.

count := 0;

1025.

For j := 1 to total_student do

1026. 1027.

if student_data[j].ans[i] = 'A' then Writeln(fileout,'

|

''A''

count := count +1;

: ',count,'

1028. (',round((count/total_student)*100),'%)'); 1029.

count := 0;

1030.

For j := 1 to total_student do

1031. 1032.

if student_data[j].ans[i] = 'B' then Writeln(fileout,'

|

''B''

count := count +1;

: ',count,'

1033. (',round((count/total_student)*100),'%)'); 1034.

count := 0;

1035.

For j := 1 to total_student do

1036.

if student_data[j].ans[i] = 'C' then

count := count +1;

80


Design - Implementation

1037.

Writeln(fileout,'

|

''C''

: ',count,'

1038. (',round((count/total_student)*100),'%)'); 1039.

count := 0;

1040.

For j := 1 to total_student do

1041.

if student_data[j].ans[i] = 'D' then

1042.

Writeln(fileout,'

|

''D''

count := count +1;

: ',count,'

1043. (',round((count/total_student)*100),'%)'); 1044. 1045.

End; Writeln(fileout,'###############################################

1046. ###############'); 1047.

Writeln(fileout,'

End of Report');

1048.

Close(fileout);

1049.

Clrscr;

1050.

show_header(8);

1051.

writeln;

1052.

Writeln('':20,'Report has been saved to ''Report.txt''...');

1053.

Writeln;

1054.

Writeln('Press any key to continue....':55);

1055.

repeat until keypressed;

1056.

eatkey := readkey;

1057. End; From line 923 to 1057 is for outputting the report of the competition. 1058. Begin 1059.

welcome;

1060.

initial;

1061.

show_menu(1,1);

1062.

Repeat

1063.

choice := read_key(1);

1064.

Case choice of

1065.

1 : Begin

1066.

show_data := student_data;

1067.

show_entry(total_student);

1068.

End;

1069.

2 : Searching;

1070.

3 : filtering;

1071.

4 : reporting;

81


Design - Implementation

1072.

5 : award;

1073.

6 : EDIT_ENTRY(0);

1074.

7 : output_report;

1075.

End;

1076.

Until choice = 8;

1077. End. From line 1058 to 1077 is the main program which is calling procedures welcome, initial, show_menu, etc.

82


Testing and Evaluation - Testing tables

First Testing Test Date: 26/8/2008 Test item

Input

Expected result

Actual result

Remark

H:\coursework

Close window

Close window

Error free

H:\coursework\

Open program

Open program

Error free

Input path

Show

individual Show

individual

Press ‘enter’ on 1

Error free data

data

Press ‘enter’ on 2 Show entry menu Quit program

Error exist

Show filter entry Press ‘enter’ on 3

Show entry menu Error exist menu Show

display Show

display

Press ‘enter’ on 4

Error free report menu

report menu

Main menu Show award for Press ‘enter’ on 5 Show award menu

Error exist students

Ask for input of Ask for input of Press ‘enter’ on 6

Error free student ID

student ID

Tell you the report Tell you the report Press ‘enter’ on 7 has

been

saved has

been

saved Error free

and a file is made and a file is made.

83


Testing and Evaluation - Testing tables

Press ‘enter’ on 8 Quit program

Quit program

Error free

Press ‘?’ on 1

No response

No response

Error free

Press ‘o’ on 5

No response

No response

Error free

Press space bar

Show next data

Show next data

Error free

Press ‘esc’

Show main menu Show main menu Error free

Individual data Show edit entry Show edit entry Press ‘E’

Error free menu

menu

Ask for input of Ask for input of Press ‘enter’ on 1

Error exist student name

student ID

Ask for input of Ask for input of Press ‘enter’ on 2

Error free student ID

Search

student ID

entry Ask for input of Ask for input of

menu

Press ‘enter’ on 3

Error free ranking

ranking

Press ‘enter’ on 4 Show main menu Show main menu Error free

Search Search

Press ‘?’ on 1

No response

No response

Error free

Press ‘X’ on 3

No response

No response

Error free

Data not found

Data not found

Error free

Data not found

Data not found

Error free

entry; yyy by chan shuk yan

84


Testing and Evaluation - Testing tables

student name

CHAN

SHUK Show data of the Show data of the Error free

YAN

student

student

show data of the show data of the 1

Error free student with id=1 student with id=1

Search

entry; 198

No response

No response

Error free

Search by id The program

is The program

is

a

Error free suspended

suspended

Show data with Show data with 1 Search

entry;

Search

by 198

ranking

Error free ranking=1

ranking=1

No response

No response

The program

is The program

Error free is

A

Error free suspended

suspended

Show data with all Show data with all M

Error free sex=M

Filter

entry;

sex=M

Show data with all Show data with all F

Filter by sex

Error free sex=F

sex=F Show data with all

N

No response

Error exist sex=M

Filter

entry; 1

Data not found

Data not found

Error free

85


Testing and Evaluation - Testing tables

Filter by age

Show data with all Show data with all 15

Error free age=15 The program

age=15 is The program

is

?

Error free suspended

suspended

Show data with all Show data with all 1 Filter

Error free school code=1

school code=1

Data not found

No response

The program

is The program

entry; 78

Error exist

Filter by school is

?

Error free suspended

suspended

Show data with all Show data with all 1;1

1;2 Filter

entry; 999;1

Filter by mark

Error free mark>1

mark>1

Data not found

Data not found

Error free

Data not found

Data not found

Error free

Show all data with Show all data with 999;2

Filter

entry;

Error free mark<999

Filter by ranking

The program

mark<999 is The program

is

a

Error free suspended The program

suspended is The program

3;e

is Error free

suspended

suspended

86


Testing and Evaluation - Testing tables

3;3

No response

No response

Error free

Show all data with Show all data with 1;1

Error free ranking=> 1

ranking=> 1

Show all data with Show all data with 1;2

999;1

Error free ranking<=1

ranking<=1

Data not found

Data not found

Error free

Show all data with Show all data with 999;2

Error free ranking<=999

ranking<=999

The program

is The program

is

a

Error free suspended The program

suspended is The program

is

3;e

Error free suspended Back

Filter

to

suspended main Back

to

main

entry; Press ‘enter’

Error free menu

menu

No response

No response

Back to menu L

Show

candidates Show

Error free

candidates

Display report; analysis with total analysis with total candidates

Press ‘enter’

Error free paticipants,

age, paticipants,

age,

analysis top10, etc. which top10, etc. which

87


Testing and Evaluation - Testing tables

consists of 2 pages consists of 2 pages L

No response Show

No response

schools Show

Error free

candidates

analysis with total analysis with total Display report; Press ‘enter’

students,

total paticipants,

age, Error exist

shcools analysis

mark, etc. which top10, etc. which consists of 4 pages consists of 2 pages L

No response Show

Display report;

No response

questions Show

Error free

questions

analysis

with analysis

with

correct

ans’ correct

ans’ Error free

Press ‘enter’ etc. percentage

etc.

questions

percentage

analysis

which consists of which consists of

L

6 pages

6 pages

No response

No response

Back

to

main Back

to

Display report; Press ‘enter’

Error free main Error free

menu

mennu

No response

No response

back to menu L Awards

Error free

Press ‘enter’ on 1 Show awards for Show awards for Error free

88


Testing and Evaluation - Testing tables

Edit entry L

students

students

No response

No response

Error free

Show awards for Show awards for Press ‘enter’ on 2

L

Error exist schools

students

No response

No response

Back

to

main Back

to

Error free main

Press ‘enter’ on 3

L

Error free menu

mennu

No response

No response

Error free

Show edit entry Show edit entry Input id=1

Error free menu

menu

The input-id will The input-id will be cleared and the be cleared and the Input id=999

program will ask program will ask Error free the user to input the user to input the id again

the id again

Ask the user to Ask the user to Press ‘enter’

input new name input new name Error free

Edit entry; name

L

for the input-id

for the input-id

No response

No response

Error free

89


Testing and Evaluation - Testing tables

Ask the user to Ask the user to Press ‘enter’

input new sex for input new name Error exist

Edit entry; sex

L

the input-id

for the input-id

No response

No response

Error free

Ask the user to Ask the user to Press ‘enter’

input new age for input new age for Error free

Edit entry; age

L

the input-id

the input-id

No response

No response

Error free

Ask the user to Ask the user to Edit

entry; Press ‘enter’

answer L

input new answers input new anwers Error free for the input-id

for the input-id

No response

No response

Error free

Ask the user to Ask the user to input new shool input new school Edit

entry; Press ‘enter’

Error free code

for

the code

for

the

school code

L Edit entry; back

input-id

input-id

No response

No response

Back

to

main Back

Press ‘enter’ to menu

to

Error free main Error free

menu

mennu

90


Testing and Evaluation - Testing tables

L

No response

No response

Error free

A statement will A statement will be Press ‘enter’

shown

as be

shown

as

“Report has been “Report has been Error free

Output report saved

to saved

to

‘report.txt’...”

‘report.txt’...”

L

No response

No response

Error free

Press ‘enter’

Quit program

Quit program

Error free

L

No response

No response

Error free

Exit

91


Testing and Evaluation - Testing tables

z

Second Testing

Test Date: 15/9/2008 Test item

Input

Expected result

Actual result

Remark

H:\coursework

Close window

Close window

Error free

H:\coursework\

Open program

Open program

Error free

Input path

Show

individual Show

individual

Press ‘enter’ on 1

Error free data

data

Press ‘enter’ on 2 Show entry menu Show entry menu Error free Show filter entry Show filter entry Press ‘enter’ on 3

Error menu

menu

Show

display Show

display

Press ‘enter’ on 4 Main menu

free

Error free report menu

report menu

Press ‘enter’ on 5 Show award menu Show award menu Error free Ask for input of Ask for input of Press ‘enter’ on 6

Error free student ID

student ID

Tell you the report Tell you the report Press ‘enter’ on 7 has

been

saved has

been

saved Error free

and a file is made and a file is made.

92


Testing and Evaluation - Testing tables

Press ‘enter’ on 8 Quit program

Quit program

Error free

Press ‘?’ on 1

No response

No response

Error free

Press ‘o’ on 5

No response

No response

Error free

Press space bar

Show next data

Show next data

Error free

Press ‘esc’

Show main menu Show main menu Error free

Individual data Show edit entry Show edit entry Press ‘E’

Error free menu

menu

Ask for input of Ask for input of Press ‘enter’ on 1

Error free student name

student name

Ask for input of Ask for input of Press ‘enter’ on 2

Error free student ID

Search

student ID

entry Ask for input of Ask for input of

menu

Press ‘enter’ on 3

Error free ranking

ranking

Press ‘enter’ on 4 Show main menu Show main menu Error free

Search Search

Press ‘?’ on 1

No response

No response

Error free

Press ‘X’ on 3

No response

No response

Error free

Data not found

Data not found

Error free

Data not found

Data not found

Error free

entry; yyy by chan shuk yan

93


Testing and Evaluation - Testing tables

student name

CHAN

SHUK Show data of the Show data of the Error free

YAN

student

student

show data of the show data of the 1

Error free student with id=1 student with id=1

Search

entry; 198

No response

No response

Error free

Search by id The program

is The program

is

a

Error free suspended

suspended

Show data with Show data with 1 Search

entry;

Search

by 198

ranking

Error free ranking=1

ranking=1

No response

No response

The program

is The program

Error free is

A

Error free suspended

suspended

Show data with all Show data with all M

Error free sex=M

Filter

sex=M

entry; Show data with all Show data with all

Filter by sex

F

N Filter

entry; 1

Filter by age

15

Error free sex=F

sex=F

No response

No response

Error free

Data not found

Data not found

Error free

Show data with all Show data with all Error free

94


Testing and Evaluation - Testing tables

age=15 The program

age=15 is The program

is

?

Error free suspended

suspended

Show data with all Show data with all 1 Filter

Error free school code=1

school code=1

Data not found

Data not found

entry; 78

Error free

Filter by school The program

is The program

is

?

Error free suspended

suspended

Show data with all Show data with all 1;1

Error free mark>1

mark>1

1;2

Data not found

Data not found

Error free

999;1

Data not found

Data not found

Error free

Show all data with Show all data with Filter

entry; 999;2

Error free mark<999

mark<999

Filter by mark The program

is The program

is

a

Error free suspended The program

suspended is The program

3;e

3;3

is Error free

suspended

suspended

No response

No response

Error free

95


Testing and Evaluation - Testing tables

Show all data with Show all data with 1;1

Error free ranking=> 1

ranking=> 1

Show all data with Show all data with 1;2

999;1 Filter

Error free ranking<=1

ranking<=1

Data not found

Data not found

Error free

entry; Show all data with Show all data with

Filter by ranking 999;2

Error free ranking<=999

ranking<=999

The program

is The program

is

a

Error free suspended The program

suspended is The program

is

3;e

Error free suspended Back

Filter

to

suspended main Back

to

main

entry; Press ‘enter’

Error free menu

menu

No response

No response

Back to menu L

Show Display report; candidates analysis

candidates Show

Error free

candidates

analysis with total analysis with total Press ‘enter’

paticipants,

age, paticipants,

age, Error free

top10, etc. which top10, etc. which consists of 2 pages consists of 2 pages

96


Testing and Evaluation - Testing tables

L

No response Show

No response

schools Show

Error free

schools

analysis with total analysis with total Display report; Press ‘enter’

students,

total students,

total Error free

shcools analysis

mark, etc. which mark, etc. which consists of 4 pages consists of 4 pages L

No response Show

Display report;

No response

questions Show

Error free

questions

analysis

with analysis

with

correct

ans’ correct

ans’

Press ‘enter’

Error free

questions

percentage

analysis

which consists of which consists of

L

etc. percentage

6 pages

6 pages

No response

No response

Back

to

main Back

to

etc.

Error free main

Display report; Press ‘enter’

Error free menu

mennu

No response

No response

back to menu L

Error free

Show awards for Show awards for Awards

Press ‘enter’ on 1

Error free students

students

97


Testing and Evaluation - Testing tables

L

No response

No response

Error free

Show awards for Show awards for Press ‘enter’ on 2

L

Error free schools

schools

No response

No response

Back

to

main Back

to

Error free main

Press ‘enter’ on 3

L

Error free menu

mennu

No response

No response

Error free

Show edit entry Show edit entry Input id=1

Error free menu

menu

The input-id will The input-id will Edit entry

be cleared and the be cleared and the Input id=999

program will ask program will ask Error free the user to input the user to input the id again

the id again

Ask the user to Ask the user to Press ‘enter’

input new name input new name Error free

Edit entry; name

Edit entry; sex

for the input-id

for the input-id

L

No response

No response

Press ‘enter’

Ask the user to Ask the user to Error free

Error free

98


Testing and Evaluation - Testing tables

input new sex for input new sex for

L

the input-id

the input-id

No response

No response

Error free

Ask the user to Ask the user to Press ‘enter’

input new age for input new age for Error free

Edit entry; age

L

the input-id

the input-id

No response

No response

Error free

Ask the user to Ask the user to Edit

entry; Press ‘enter’

answer L

input new answers input new anwers Error free for the input-id

for the input-id

No response

No response

Error free

Ask the user to Ask the user to input new shool input new school Edit

entry; Press ‘enter’

Error free code

for

the code

for

the

school code

L

input-id

input-id

No response

No response

Back

to

main Back

to

Edit entry; back Press ‘enter’

Error free main Error free

menu

mennu

No response

No response

to menu L

Error free

99


Testing and Evaluation - Testing tables

A statement will A statement will be Press ‘enter’

shown

as be

shown

as

“Report has been “Report has been Error free

Output report saved

to saved

to

‘report.txt’...”

‘report.txt’...”

L

No response

No response

Error free

Press ‘enter’

Quit program

Quit program

Error free

L

No response

No response

Error free

Exit

100


Discussion and Conclusion - Discussion

To write this program, I spent near 35 hours. I am quite satisfied with my program as there is no error exists. Also, the functions can work well and associate together. However, it is not perfect. Thus, other than the strengths, there aare also some weaknesses. In this part, I am going to list out the strengths and weaknesses of my program. 1.

strengths of the program First, the program is organized well. The functions of the program are written separately in different modules and then combined together to form a main program. As each module only does few small jobs, thus, it is easier to modify it. Furthermore, the main program is well-designed that it allows adding new functions freely. Therefore, whenever I want, I can add some new functions to it conveniently without changing the core part. Second, its file size is very small. The size of the program is 49.5 KB. The total size of data files is only 7.96KB. Therefore, the total size of all files does not exceed 60KB. This is convenient that the whole program can be saved in even a floppy disk. Third, the processing speed of the program is really fast that there is no delay and waiting time. This is simply because there is no calculation needs to be worked out in the program.

101


Discussion and Conclusion - Discussion

Forth, the program needs a low requirement of computer only. As the program can be run in most platforms. Also, it is because the small file size requires a little RAM only. Even the computer, which is old-model, can run the program. Fifth, the program has lots of function that the other’s program may not have. For example, the filter function which allows user to separate the data that he wants from he does not want and a function can output a report of the analysis which is text file and printable. These functions provide lots of convenience to the user. Sixth, the program is reusable, that means the program can run correctly with different set of data files. If the data is in the correct format, calculation, ranking, searching, and reporting can also function no matter how many entries are inside the file. This is very important as we can use the same program again when there is another competition. Seventh, the structure of the database is very well designed. Data can be added and edited easily in the data file. It is because the whole database is spitted into different text file which store different kinds of information and the key filed of each entry is the identifier in different text file. Eighth, the programming language is very readable, therefore, debugging

102


Discussion and Conclusion - Discussion

work and maintaining work is easy to do. Moreover, the program is easy enough for other programmers to develop and add more function on it. Last, the layout of the program is very user-friendly. Users use only the arrow keys and enter key can control all the instructions. And all of the instrctions of the program is clearly displayed , thus, it is very easy for user to understand and use it. 2.

Weaknesses of the program When searching the entry by student name, all the letters should be capital letter. Whenever the user search or filter entry, the input should be the correct variable type such as string for name, integer for mark, ranking and id. If the input does not match the required variable type, the program will suspended. When editing the answer of entry, the user has to type all the answers of the entry once by himself. If he just wants to correct one of the answer, this will cause a great inconvenience.

103


Discussion and Conclusion - Discussion

Besides the above weaknesses, my program can still be improved in order to make it perfect. 3.

Suggested improvements: First, the program can have more beautiful layout as this one cannot be classified as beautiful. A beautiful layout is important that it can attract people to use it. Everyone likes beautiful things. Second, some operation rules can be written on the program so that the user can avoid these and the caused inconveniences can be reduced. Last, the letters of the program can be larger. As the size of the letter now is not big enough. Some may think that it is difficult to see.

104


Discussion and Conclusion - Conclusion

The program has been finished. Pleasantly, there are no errors in my program. All the task objectives are achieved. My program gives lots of conveniences to user. First, the user just press ‘Enter’ and all the things are done by the program unless the user wants to search, edit and filter entry. Second, bar charts of my program allow user to figure out the position of each participants quickly and easily. Third, the program has a function to output a report in the form of text file. This provides a convenience for user as he does not need to create one by himself. Forth, the search function is also available in my program which allows user to find entry easily and rapidly. Fifth, the filter function is special that the user can read the data which satisfies his requirements. Last, the edit function helps user the change data quickly as he does not need to find out the data of specific entry in a numerous of data. Other than the task objectives, all the learning objectives are reached also. First, I learnt my skills of pascal on the Internet such as delay, drawing charts, making text file, making menu etc. Second, my English has been improved a lot since I have practiced a lot with various of sentence structures and learnt lots of vocabulary items. Moreover, the pronunciation is also improved during presentation as my classmates corrected me. Third, my presentation skills are improved. My voice intensity is loud enough so everyone can hear me clearly. Also,

105


Discussion and Conclusion - Conclusion

the speed is medium. Forth, my problem solving skills are improved. When I faced questions, I would try to solve it by myself first. If the problem could not be solved, I would seek for help. Also, I know I can break a big problem into small pieces now. Small problem is always easier to solve. Fifth, I become braver. I am not that afraid of speaking in front of people now. At least better than before. Sixth, I have increased my knowledge in technology and Internet when I searched information on the Internet. I found there were many technology products which was I never knew. Last, I increased my interest in both technology and Internet. As there were many things I did not know and which were new. I am interested in studying on them.

106


Reference - Books

1.

Name: Pascal 語言三日通 Author: 招兆鏗 Publisher: 萬里機構

2.

Name: Pascal 程序設計 Author: 朱玉文 Publisher: 國防工業出版

3.

Name: Pascal : an introduction to modern programming Author: Goldstein, Larry Joel. Publisher: New York : Holt, Rinehart and Winston, 1988.

4.

Name: PASCAL 程序設計習題與選解 Author: 楊德元 Publisher: 清華大學出版社

5.

Name: Pascal for students, including Turbo Pascal Author: Brian D. Hahn, Ray Kemp. Publisher: London : Arnold, 1996.

107


Reference - Websites

1.

Name: URL: http://en.wikipedia.org/

2.

Name: Irie Pascal Programmer's Reference Manua URL: http://www.irietools.com/iriepascal/progref.html

3.

Name: Turbo Pascal Programmers Page URL: http://www.devq.net/pascal/

4.

Name: Pascal Programmers Paradise URL: http://www.petewww.kiev.ua/ppp/

5.

Name: John's Pascal Page URL: http://www.merlyn.demon.co.uk/

6.

Name: Ultimate Pascal URL: http://www.majicware.com/pascal/turbo_pascal.html

7.

Name: Pascal Central URL: http://pascal-central.com/

8.

Name: ERT 2007 HKCEE CIT Project 教學網 URL: http://personal.tsss.edu.hk/ert/cit/07/project/index.html

9.

Name: Turbo Pascal Infobase URL: http://infobase.hypermart.net/

108


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.