Home > Education, IDIC, Informatics > C1005 C Programming Project Term 1 2008, Part 2, Documentation 1

C1005 C Programming Project Term 1 2008, Part 2, Documentation 1

February 2nd, 2009

I have posted the proposal for this module in the previous post. Now I will start to post the documentation of this module’s project.

TABLE OF CONTENTS

Chapter

Sections

Description

Page

Cover page

1

Table of Contents

2

1

Current System

3

2

Proposed New System

5

3

Program Specification

3.1

Specification – file specification

7

3.2

Specification – processing & validation

7

3.3

Messages used in this program

11

3.4

Specification – screen design

13

4

Program Design – Pseudocode

31

5

Program Listing

48

6

Testing

6.1

Testing – Test plan

123

6.2

Testing – Test case and result

125

6.3

Testing – Test log

185

7

Program Implementation

7.1

Hardware & Software Configuration

187

7.2

User manual

188

a) CD contents

188

b) Operating Guide

190

8

Conclusion

8.1

Program Strengths

196

8.2

Program Weakness

196

8.3

Program Enhancements

197

1.0 CURRENT SYSTEM

Super Gamers (SG) is a gaming center in Singapore that rent games from various game consoles for everyone to play on the shop. A group of university student founded it in 2001. SG was so famous among gamers in Singapore because it allows the member to play games with affordable price, vast selection of game console, and has a wide collection of games ranging from old era games to the most recent games. No wonder, SG has so many customers and keep increasing every year because of its excellent reputation.

Currently, Super Gamer’s staffs do their daily job with this system:

  • When there is a customer who wants to play a game in a particular game console, he/she has to register to be a SG’s member. To do this, the staff will write down all required information about the new customer including what console he want to play (e.g. PS2/XBOX360/Wii) in a printed form, then manually assign him/her with a member ID.
  • If there is a member who want to change his personal detail like his/her phone number, address, etc. The staff needs to open the member document and search manually for the member’s file, then after the staff found it the information can be edited.
  • When the staff need to check or search information about a member, the staff will need to manually search the member files manually, which can be difficult in a large number of members.
  • If there is a member who are inactive for a long period of time, the staff will need to remove the membership of that particular member. To do this, again the staff have to manually search for the intended member’s file then throws it away from member document.

This current system is complicated and has some problem:

a. Slow process

The process of adding new member data and search for a particular member or game title will be very tiring and time consuming when the list of member is huge. This problem becomes worse because the company get new members every week.

b. Human Error

With that manual system, the risk of human error is increased. The staff can be too tired and make mistake when creating, editing, searching, or deleting the record of a member.

2.0 PROPOSED NEW SYSTEM

In order to solve the problems of the Super Gamer’s current system, SG will need to implement a new system for its member registration and management.

This new system will make the member management activity become more efficient and reduce the risk of human error.

The features of the new system are:

a. Add member module

It allows easier process to add record of new member, including his/her information like Name, Gender, NRIC/Passport, Contact Number, etc.

After the user choose Add member module from the main menu, user will see a form that have all the required information fields for a particular member. The first field is the member ID that will be automatically assigned by the system; this will avoid the risk that there are two members with the same ID. Then user can start filling up all the required fields, there are total 7 fields that needs to be completed: User ID, Name, Name, Gender, NRIC/Passport, Contact number, Nationality, and Occupation. Each field come with its own validation rule, for example Contact number field must be filled with numbers only and also it cannot be too short or too long, these validation rules for each field will help to preserve data integrity.

b. Search member module

It is used to search the data and information of a particular member that the staff needs to know.

When user opens this module, he/she will be prompted to enter the ID for the record that he/she wants to search. If the record found, all the information about the record will be displayed, if not, there will be a message to tell the user that there is no record with that ID. After that, user will be asked if he/she wants to search for another record.

c. Edit member module

This module is used to change or edit some information about a member. This edit member module is very useful especially when a member change his personal particular like his/her contact number or maybe the user entered the wrong data when he/she add a member and now the user wants to correct it without deleting the existing record.

When user opens this module, he/she will be prompted to enter the ID for the record that he/she wants to edit. If the record found, all the information about the record will be displayed, if not, there will be a message to tell the user that there is no record with that ID. In case the record is found, now the user can choose to edit what field in this record. Finally, the user will be asked if he/she wants to edit another record.

d. Display member module

The user can display the entire member list with this module. After the user chooses to enter display member module from the main menu, user will see the list of all the member records. It’s very simple and easy to use.

e. Delete member module

This module is to delete any member data when the user needs to do so. After the user select to enter delete member module from the main menu he/she will be prompted to enter the ID for the record that he/she wants to delete. If the record found, all the information about the record will be displayed, if not, there will be a message to tell the user that there is no record with that ID. Then, the program will ask confirmation from the user whether he/she really wants to delete this record or not. Finally, the user will be asked if he/she wants to delete another record.

3.0 PROGRAM SPECIFICATION

3.1 Specification – File Specification

No.

Item Name

Description

Data Type

Size

Range

1.

mem_name

Member Name

Char

30

A-Z, a-z

2.

Mem_gender

Member Gender

Char

1

M / F

3.

mem_nric

NRIC / Passport No.

Char

14

A-Z, 0-9

4.

Mem_contact

contact number

Char

16

0-9

5.

Mem_nation

Member Nationality

Char

2

A-Z, a-z

6.

mem_job

Member Occupation

Char

15

A-Z, a-z

7.

Id

Member’s ID

Int

-

1-999

Note*:

The records for this program will be saved as a file named “tsg.dat“. The location of this file will be “c:\\tsg.dat“.

3.2 Specification- Processing and Validations

1.      Name

v  Name field accepts alphabets only, it’s a character array that able to accept up to 30 characters. User can enter both lowercase or upper case and also space in this field. This name field is designed to contain both the member’s first name and last name.

v  There is a minimum and maximum length for this name field. The minimum length is 3 characters and the maximum length is 30 characters. If user entered a name less than the minimum or more than the maximum length, a warning message “Name length must be 3 to 30 characters only!” will appear and the user will need to try again.

v  If the user try to enter data other than alphabet in this field, a warning message “Name must be alphabets only…” will appear and the user will need to try again.

2.      Gender

v  Gender field only accepts two possible inputs: “M” or “F”, either the lowercase or the uppercase. If the user entered another value, a warning message “Gender must be M or F!!” will appear and the user will need to try again.

3.      NRIC / Passport

v  NRIC or Passport number field accepts alphanumeric entry with length from 7 characters to 9 characters.

v  If user enter less than 7 characters, a warning message “NRIC/Passport too short..” will appear and the user will need to try again.

v  If user enter more than 9 characters, a warning message “NRIC/Passport too long..” will appear and the user will need to try again.

v  If user tries to enter data other than alphanumeric (e.g. punctuations), a warning message “Invalid! Only Accept Alphabets & Number…will appear and the user will need to try again.

4.      Contact Number

v  Contact number field accepts numeric data only with length from 6 until 16 digits.

v  If user enter less than 6 digits, a warning message “Contact No. cannot be less than 6 digits..” will appear and the user will need to try again.

v  If user enter less than 16 digits, a warning message “Contact No. cannot be more than 16 digits..” will appear and the user will need to try again.

v  If tries to enter data other than numeric digit, a warning message “Invalid! Only Accept Number…” will appear and the user will need to try again.

5.      Nationality

v  Nationality field accepts member’s nationality in two characters code (e.g. Singapore – sg).

v  If user enter less than 2 characters or more than 2 characters in this field, a warning message “Nationality code is 2 characters only…“will appear and the user will need to try again.

v  If user enter a data other than alphabet (e.g. number), a warning message “Invalid! Only Accept Alphabets…” will appear and the user will need to try again.

6.      Occupation

v  Occupation field accepts alphabet entry with length from 4 to 15 characters.

v  If user enter less than 4 characters, a warning message “Contact Too Short!minimum of 4 characters for occupation field..” will appear and the user will need to try again.

v  If user enter less than 15 digits, a warning message “Too Long!Occupation field accepts maximum of 15 characters” will appear and the user will need to try again.

v  If tries to enter data other than alphabet into this field, a warning message “Invalid! Only Accept Alphabets…” will appear and the user will need to try again.

7.      ID

v  This field contains the member identification number or member’s ID.

v  The data type of this field is integer

v  Member ID will be assigned automatically by this software to avoid duplicate member ID.

v  If there is no other record, member ID will start from 1, then it will incremented by 1 for subsequent record.

8.      Login Screen

v  This Screen will ask for user name and password from the user at the beginning of the software, login is required to ensure that only authorized user can use the program.

v  There are two profile in this program

v  The first profile is administrator profile which can be accessed by entering “admin” as user name, and “admin123” as the password. Administrator profile has full access to the program.

v  The second profile is guest profile which can be accessed by entering “guest” as user name, and leaves the password field blank. Guest profile has a very limited access to the program feature, guest profile only able to use the search member module and the help menu.

v  User is given total three chances to enter the correct user name and password. If user entered the wrong user name or password, a warning “invalid user name or password, try again.” and also “you have x more chance(s) to try” will appear on the screen.

v  If the user fail to enter the correct user name and password for three times, this message will be displayed “Sorry, try again next time..“, “Press any key to exit…” and the program will be closed after the user press any key.

3.3 Messages used in this program

1) Add Member Module

Ø  Save Record[Y/N]?:_

Ø  In case of invalid choice, this message will appear “Invalid choice,please try again…

Ø  Add more record[Y/N]?_

2) Delete Member Module

Ø  If the file is empty, this message will appear “Error, No record in the file“.

Ø  confirm delete[Y/N]?_

Ø  In case if the ID for the record to be deleted is not found, this message will appear “Not Found“.

3) Display Member Module

Ø  After all the records displayed, this message will appear “Back to main menu“. So, after the user press any key, it will bring the screen back to main menu.

Ø  If there are more than 10 records, after the first 10 records are displayed, this message will appear “Next Record“. After the user press any key, the next 10 records will be displayed on the screen.

4) Search Member Module

Ø  If the file is empty, this message will appear “Cannot open file“.

Ø  In case that the target record is not found, this message will appear “——–Unable To Find The Record———“.

Ø  Search for Another Record[Y/N]?_

5) Edit Member Module

Ø  If the file is empty, this message will appear “Cannot open file“.

Ø  Choice[1-7]:_

Ø  In case of invalid choice, this message will appear “Invalid choice“, “Press any key and Try again

Ø  Edit another record[Y/N]?

6) Help Menu

Ø  Enter your choice[1-8]:_

Ø  In case of invalid choice, this message will appear “Invalid!! Choice must be 1-8 only…

Note*:

Beside the main administrator profile that user can access by entering “admin” as the user name and “admin123” as the password. User can also sign in as guest by entering “guest as user name and type no password.

When signing-in as guest, some module will be disabled. Only Search Member module and Help Menu can be accessed by the user when signing-in as guest. The information provided when using the search module as a guest will also limited to just three information: member ID, Name, and gender.

3.4 Specification – Screen Design

This part contain a lot of picture and screen shots, so I will give just one example for the first point, login screen.

3.4.1) Login Screen

login-screen-design

login-screen-2

3.4.2) Main Menu

3.4.3) Add Member Module

3.4.4) Delete Member Module

3.4.5) Display Member Module

3.4.6) Search Member Module

3.4.7) Edit Member Module

3.4.8) Help Menu

3.4.9) About Super Gamers – Help

3.4.10) About Super Gamers Customer Registration System – Help

3.4.11) How to add new member record – Help

3.4.12) How to delete a member record – Help

3.4.13) How to display all member records – Help

3.4.14) How to search a member record – Help

3.4.15) How to edit an existing member record – Help

3.4.16) Guest – Main Menu

3.4.17) Guest – Search Member Module

3.4.18) Exit Screen

4.0 Program Design – Pseudocode

4.1) Main

DO

CALL login screen

ENDDO

4.2) Login Screen

DO

DISPLAY login form

CALL User name & password validation

ENDDO

4.3) User name & password validation

DO

SET attempt to 1

DO

WHILE not valid AND attempt < 4

GET User name

GET Password

IF User name AND Password is valid

DO

SET valid to true

CALL Main menu

ENDDO

ELSE

DO

SET valid to false

Increase attempt by 1

ENDDO

ENDIF

ENDDO

ENDDO

4.4) Main Menu

DO

WHILE valid_choice is false

DISPLAY main menu

GET choice

DO

CASE

Choice – 1

DO

CALL Add module

SET valid_choice to true

ENDDO

Choice – 2

DO

CALL Delete module

SET valid_choice to true

ENDDO

Choice – 3

DO

CALL Display module

SET valid_choice to true

ENDDO

Choice – 4

DO

CALL Search module

SET valid_choice to true

ENDDO

Choice – 5

DO

CALL Edit module

SET valid_choice to true

ENDDO

Choice – 6

DO

CALL Help menu

SET valid_choice to true

Choice – 7

DO

CALL Exit screen

SET valid_choice to true

ENDDO

Choice – default

DO

DISPLAY error message

SET valid_choice to false

ENDDO

ENDCASE

ENDDO

ENDDO

4.5) Add Member Module

DO

WHILE choice ‘Y’

DO

OPEN sgfile

DISPLAY record fields

CALL Confirm name validation module

CALL Validate gender module

CALL Confirm NRIC validation module

CALL Confirm contact validation module

CALL Confirm Nationality validation module

CALL Confirm Occupation validation module

GET save_choice

IF save_choice – ‘Y’

DO

WRITE record to sgfile

CLOSE sgfile

ENDDO

ELSE

DO

CLOSE sgfile

ENDDO

ENDIF

DO

WHILE valid_choice is false

GET choice

IF choice – ‘Y’

SET valid_choice to true

ELSE

IF choice – ‘N’

SET valid_choice to true

ELSE

SET valid_choice to false

ENDIF

ENDIF

ENDDO

ENDDO

ENDDO

4.6) Validate name length module

DO

WHILE valid is false

GET mem_name

IF length of mem_name < 3 OR length of mem_name > 30

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDDO

4.7) Validate name data type module

DO

SET idx to 0

WHILE idx < length of mem_name

c <- mem_name[idx]

IF c is not alphabet OR c is not space

DISPLAY warning message

RETURN false

ELSE

RETURN true

ENDIF

Increment idx by 1

ENDDO

DO

WHILE validate name data type module return false

CALL validate name length module

ENDDO

4.9) Validate gender module

DO

WHILE valid is false

GET mem_gender

IF mem_gender not equal to ‘M’ OR mem_gender not equal to ‘F’

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDDO

4.10) Validate NRIC length module

DO

WHILE valid is false

GET mem_nric

IF length of mem_nric < 7

DISPLAY warning message

SET valid to false

ELSE

IF length of mem_nric > 9

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDIF

ENDDO

4.11) Validate NRIC data type module

DO

SET idx to 0

WHILE idx < length of mem_nric

c <- mem_nric[idx]

IF c is not alphabet OR c is not digit

DISPLAY warning message

RETURN false

ELSE

RETURN true

ENDIF

Increment idx by 1

ENDDO

4.12) Confirm NRIC validation module

DO

WHILE validate NRIC data type module return false

CALL validate NRIC length module

ENDDO

4.13) Validate contact length module

DO

WHILE valid is false

GET mem_contact

IF length of mem_contact < 6

DISPLAY warning message

SET valid to false

ELSE

IF length of mem_contact > 16

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDIF

ENDDO

4.14) Validate contact data type module

DO

SET idx to 0

WHILE idx < length of mem_contact

c <- mem_contact[idx]

IF c is not digit

DISPLAY warning message

RETURN false

ELSE

RETURN true

ENDIF

Increment idx by 1

ENDDO

4.15) Confirm contact validation module

DO

WHILE validate contact data type module return false

CALL validate contact length module

ENDDO

4.16) Validate nationality length module

DO

WHILE valid is false

GET mem_nation

IF length of mem_nation not equal to 2

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDDO

4.17) Validate nationality data type module

DO

SET idx to 0

WHILE idx < length of mem_nation

c <- mem_nation[idx]

IF c is not alphabet

DISPLAY warning message

RETURN false

ELSE

RETURN true

ENDIF

Increment idx by 1

ENDDO

4.18) Confirm nationality validation module

DO

WHILE validate nationality data type module return false

CALL validate nationality length module

ENDDO

4.19) Validate occupation length module

DO

WHILE valid is false

GET mem_job

IF length of mem_job < 4

DISPLAY warning message

SET valid to false

ELSE

IF length of mem_job > 15

DISPLAY warning message

SET valid to false

ELSE

SET valid to true

ENDIF

ENDIF

ENDDO

4.20) Validate occupation data type module

DO

SET idx to 0

WHILE idx < length of mem_job

c <- mem_job[idx]

IF c is not alphabet

DISPLAY warning message

RETURN false

ELSE

RETURN true

ENDIF

Increment idx by 1

ENDDO

4.21) Confirm occupation validation module

DO

WHILE validate occupation data type module return false

CALL validate occupation length module

ENDDO

4.22) Delete Member Module

DO

GET target_id

OPEN sgfile

OPEN temp

DO

WHILE not end of sgfile

IF target_id equals to member.id

COPY record from file to target record

ELSE

COPY record from file to temp file

ENDIF

ENDDO

IF target_id is found

DISPLAY target record

GET user choice

IF user choice <- ‘Y’

DELETE sgfile

RENAME temp to sgfile

CLOSE sgfile

CALL main menu

ELSE

DELETE temp

CLOSE sgfile

ENDIF

ELSE

DISPLAY warning message

CLOSE sgfile

DELETE temp

ENDIF

ENDDO

4.23) Display Member Module

DO

SET counter to 0

OPEN sgfile

DO

WHILE not end of file

DISPLAY record

ADD counter by 1

IF counter equal to 10

DISPLAY message

GET user response

Clear screen

ENDIF

ENDDO

ENDDO

4.24) Search Member Module

DO

WHILE choice ‘Y’

GET target_id

OPEN sgfile

SET idx to 1

DO

WHILE not end of file

IF target_id equals to record idx

SET found to true

ELSE

SET found to false

ENDIF

ENDDO

IF found is true

DISPLAY record

ELSE

DISPLAY warning message

ENDIF

CLOSE sgfile

DO

WHILE flag is false

GET user choice

IF choice – ‘Y’

SET flag to true

ELSE

IF choice – ‘N’

SET flag to true

ELSE

SET flag to false

ENDIF

ENDIF

ENDDO

4.25) Edit Member Module

DO

WHILE choice – ‘Y’

GET target_id

OPEN sgfile

SET idx to 1

DO

WHILE not end of file

IF target_id equals to record idx

SET found to true

ELSE

SET found to false

ENDIF

ENDDO

IF found is true

DISPLAY record

GET user choice

CASE

User choice – 1

EDIT name

User choice – 2

EDIT gender

User choice – 3

EDIT NRIC/Passport

User choice – 4

EDIT contact

User choice – 5

EDIT nationality

User choice – 6

EDIT occupation

ENDCASE

ELSE

DISPLAY warning message

ENDIF

DO

WHILE flag is false

GET user choice

IF choice – ‘Y’

SET flag to true

ELSE

IF choice – ‘N’

SET flag to true

ELSE

SET flag to false

ENDIF

ENDIF

ENDDO

4.26) Help Menu

DO

WHILE valid_choice is false

DISPLAY help menu

GET choice

DO

CASE

Choice – 1

DO

CALL About Super Gamers module

SET valid_choice to true

ENDDO

Choice – 2

DO

CALL About Super Gamers Customer Registration System module

SET valid_choice to true

ENDDO

Choice – 3

DO

CALL How to add new member record module

SET valid_choice to true

ENDDO

Choice – 4

DO

CALL How to delete a member record module

SET valid_choice to true

ENDDO

Choice – 5

DO

CALL How to display all member records module

SET valid_choice to true

ENDDO

Choice – 6

DO

CALL How to search a member record module

SET valid_choice to true

Choice – 7

DO

CALL How to edit an existing record module

SET valid_choice to true

ENDDO

Choice – 8

DO

CALL main menu

SET valid_choice to true

ENDDO

Choice – default

DO

DISPLAY error message

SET valid_choice to false

ENDDO

ENDCASE

ENDDO

ENDDO

4.27) Help – About Super Gamers

DO

DISPLAY Help – About Super Gamer

CALL help menu

ENDDO

4.28) Help – About Super Gamers Customer Registration System

DO

DISPLAY Help – About Super Gamers Customer Registration System module

CALL help menu

ENDDO

4.29) Help – How to add new member record

DO

DISPLAY Help – How to add new member record module

CALL help menu

ENDDO

4.30) Help – How to delete a member record

DO

DISPLAY Help – How to delete a member record module

CALL help menu

ENDDO

4.31) Help – How to display all member records

DO

DISPLAY Help – How to display all member records module

CALL help menu

ENDDO

4.32) Help – How to search a member record

DO

DISPLAY Help – How to search a member record module

CALL help menu

ENDDO

4.33) Help – How to edit an existing record

DO

DISPLAY Help – How to edit an existing record module

CALL help menu

ENDDO

4.34) Exit Screen

DO

DISPLAY message

End program

ENDDO

5.0 Program Listing

To be continued in the next post….

Do you have any comment on this? maybe you have something to ask me or want to discuss with me about this?Or maybe you are IDIC student and taking this module also?
Feel free to use the comment box below (click here if you cannot see the comment box).

admin Education, IDIC, Informatics , , , ,

  1. eunice
    April 26th, 2009 at 18:18 | #1

    hello,thanks a lot for this great information,im very grateful u are one in a million.but,pls i ve a complain i need 2 write mine on ’student course registration system’d c program.im kind of confused dont know were to start from,pls can u be of help.im a new student in informatics.and expecting 2 submit it on or before 29 of may 2009.i need your assistance.thanks.

  2. June 24th, 2009 at 03:09 | #2

    I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.

  3. aizel
    August 23rd, 2009 at 19:03 | #3

    hi can u plz help me make a program?..

  4. azuka
    August 23rd, 2009 at 19:04 | #4
  5. July 4th, 2010 at 13:04 | #5

    This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post. Thanks!

  1. February 8th, 2009 at 19:45 | #1
  2. February 11th, 2010 at 08:09 | #2

Bad Behavior has blocked 304 access attempts in the last 7 days.

Bad Behavior has blocked 304 access attempts in the last 7 days.