it sba project 2015 - ilovelessons...must utilize management and organizational skills in order to...

73
IT SBA PROJECT 2015

Upload: others

Post on 10-Apr-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

IT SBA PROJECT 2015

Page 2: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

1 | P a g e

Contents 1. PURPOSE OF THE PROGRAM .......................................................................................................2

2. WHY USE THIS PROGRAMMING LANGUAGE? ..............................................................................2

3. MINIMUM HARDWARE REQUIREMENTS .....................................................................................3

4. SOFTWARE REQUIREMENTS ........................................................................................................3

5. SETTING UP PROGRAM ...............................................................................................................4

6. ALGORITHM FOR PROGRAM .......................................................................................................8

1. THIS MODULE IS FOR SETTING SCREEN ............................................................................................ 8

2. THIS MODULE IS FOR ACCEPTING INTEGER VALUES ONLY ............................................................... 9

3. THIS MODULE IS FOR ACCEPTING ALPHANUMERIC VALUES ONLY ................................................ 10

4. THIS MODULE GRANTS ACCESS FOR REGISTERED USERS ............................................................... 11

5. THIS MODULE DISPLAYS AUTHOR’S NAME ..................................................................................... 15

6. THIS MODULE HAVE ALL THE TABLE HEADERS ............................................................................... 16

7. THIS MODULE OBTAINS AND STORES DATA ON A MASQUERADER ............................................... 18

8. THIS MODULE DISPLAYS REGISTERED MASQUERADERS IN THEIR DESIGNATED SECTION............. 22

9. THIS MODULE DEISPLAYS THE TOTAL AMOUNT REGISTERED MASQUERADERS AND TOTAL

AMOUNT OF MONEY EARNED IN EACH SECTION ................................................................................... 27

10. THIS MODULE DELETES STORAGE FILES ...................................................................................... 29

11. THIS MODULE DISPLAYS AN EXITING SCREEN ............................................................................ 31

12. THIS MODULE IS THE MAIN SCREEN OF PROGRAM AND RUNS SPECIFIED MODULE BY USER .. 32

13. THIS MODULE DISPLAYS THE WELCOME SCREEN AND INITIALISES CORE VARIABLES ............... 33

14. MAIN PROGRAM SHOULD RESEMBLE THIS ................................................................................ 35

7. DRY RUNNING THE ALGORITHM WITH TRACE TABLE ................................................................. 36

1. LISTING THE MASQUERADERS FROM DATABASE TO BE USED TO TEST ALGORITHM .................... 36

2. OPTION 1 – REGISTER NEW MASQUERADER .................................................................................. 36

3. OPTION 2 – VIEW MASQUERADERS @ SECTION ............................................................................ 36

4. OPTION 3 – VIEW TOTAL AMOUNT @ SECTION ............................................................................. 37

5. OPTION 4 – MODIFY STORAGE FILES .............................................................................................. 37

6. OPTION 5 – QUIT PROGRAM ........................................................................................................... 38

8. PROGRAM CODE....................................................................................................................... 38

9. BASIC FLOW STRUCTURE OF THE PROGRAM .............................................................................. 72

Page 3: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

2 | P a g e

1. PURPOSE OF THE PROGRAM

Carnival Has Long Been A Traditional Cultural Festival In Several Caribbean Territories. Every Year,

Thousands Of Costumed Masqueraders Parade Through The Streets. Most Of These Revellers Register To

Participate In The Band Of Their Choice Months Before The Festivities Begin. Organizers Of These Bands

Must Utilize Management And Organizational Skills In Order To Stage A Successful Event.

The Program Makes The Work Of The Organiser More Simple By Keeping A Record Of All Persons Who Came

To Register And Participate In Their Favoured Section Of The Band. In Addition To This, The Program Keeps

Account Of All Registered Masqueraders In Section As Well As The Total Amount Of Money Earned In Each

Section. All Recorded Information By The Program Is Stored For Later Use And For Easier Mobility Of The

Software.

2. WHY USE THIS PROGRAMMING LANGUAGE?

Pascal Programming Language Is Makes Use Of English-Like Statements For The Creation Of The

Source Code.

Pascal Programming Language Is Makes Use Of English-Like Statements For Easier Debugging And

Maintenance Of Program.

Pascal Programming Language Contains All The Necessary Data Structures For The Solution Of

Problem.

Pascal Programming Language Supports Structured Programming (Main Program Is Built Using

Subprograms)

Pascal Programming Language Is Not Machine Dependent (Can Operate On Other Machines Also).

Page 4: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

3 | P a g e

3. MINIMUM HARDWARE REQUIREMENTS

HARDWARE PURPOSE

256 MB RAM The Executing Of The Program

1 GHz Dual Core Processor The Operations Of The Program

1 GB Video Memory The Manipulation Of Graphics Of The Program

256 MB Free Storage Installation Of Pascal, Program And Data Storage

Monitor Visual Output Of The Program

Keyboard User Input For Program

USB Port/CD-Drive/SD Card Reader Mobility Of Program

4. SOFTWARE REQUIREMENTS

SOFTWARE PURPOSE

Windows Operating System (XP Or Newer) Management Of Computer Resources

Free Pascal (2.6.2) Compilation Of Program

Word Processor Making Adjustments To Documentation

Page 5: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

4 | P a g e

5. SETTING UP PROGRAM Steps:

1. Place Program In An Easily Accessible Location Such As The Desktop.

2. Open The Program.

3. The Program Should Start As Shown Below.

4. Log In As Admin, Guest Or User. Guest Login Has Limited Features Of The Program. User Login Has

Most Features Of The Program. Admin Login Will Have All Features Of The Program. The Program

Will Only Have One Admin User Which Is The First Registered User Of The Program.

Page 6: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

5 | P a g e

5. The Program Should Open As Shown Below.

6. Option 1 Allows The User To Register A New Masquerader.

Page 7: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

6 | P a g e

7. Option 2 Allows The Viewing Of All Masqueraders And Their Designated Sections.

8. Option 3 Allows The User To View The Total Registered Masqueraders And Total Money Earned For

Each Section.

Page 8: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

7 | P a g e

9. Option 4 Confirm Deletion Of Storage Files

10. Option 5 Exits The Program.

Page 9: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

8 | P a g e

6. ALGORITHM FOR PROGRAM

1. THIS MODULE IS FOR SETTING SCREEN (Background Colour, Borders, Etc.)

MODULE Initialise

Begin

textBackground (BG)

clrscr

textBackground (Border)

textcolor (Border)

gotoxy(1, 1)

For Number:=1 to 80 Do Write('_')

For Number:=1 to 25 Do

Begin

gotoxy(1, Number)

Write('_-')

gotoxy(79, Number)

Write('_-')

end for loop

gotoxy(1, 1)

For Number:=1 to 80 Do Write('_')

gotoxy(mX + 1, 1)

textcolor (Brand)

Write('TRINI REVELERS 2015 ')

textcolor (LText)

Write('BY ')

textcolor (Author)

Write('DARREN FUNG')

textBackground (BG)

textcolor (LText)

End MODULE Initialise

Page 10: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

9 | P a g e

2. THIS MODULE IS FOR ACCEPTING INTEGER VALUES ONLY (ENSURES ALPHA CHARACTERS ARE NOT PRESSED)

MODULE VerfiyInt (aX, aY:integer VAR num:integer)

Begin

gotoxy(aX, aY)

For Number:=1 to CLimit Do Write(' ')

alpha:=''”

cc:=0

gotoxy(aX, aY)

Repeat

let[0]:=Readkey

If( (let[0] = #8) AND (cc > 0) ) Then

Begin # For Backspacing

cc:= cc - 1

gotoxy(aX + cc, aY)

Write(' ')

alpha:=''”

gotoxy(aX + cc, aY)

If(cc > 0) Then For Number:=1 to cc Do alpha:=alpha + let[Number]

End

Else If( (lowercase(let[0]) IN ['0'..'9']) AND (cc < CLimit) ) Then

Begin # For Acceptable Input Characters

cc:=cc + 1

Write(let[0])

alpha:=alpha + let[0]

let[cc]:=let[0]

end if..else statement

Until( (let[0] = #13) AND (cc > 0) )

Val(alpha, num, Number)

If(Number <> 0) Then num:= -1

End MODULE VerfiyInt

Page 11: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

10 | P a g e

3. THIS MODULE IS FOR ACCEPTING ALPHANUMERIC VALUES ONLY (ENSURES FIELD IS NOT LEFT BLANK)

MODULE Authenticate (aX, aY, input:integer VAR alpha:string)

Begin

let[0]:=' '

let[1]:='R'

let[2]:='E'

let[3]:='V'

let[4]:='E'

let[5]:='L'

let[6]:='L'

let[7]:='E'

let[8]:='R'

let[9]:='S'

num:=1

cc:=0

alpha:=''

gotoxy(aX, aY)

Repeat

let[0]:=Readkey

If( (let[0] = #8) AND (cc > 0) ) Then

Begin # For backspacing

cc:= cc - 1

If(num > 1) Then num:= num - 1

Else num:=FLimit

gotoxy(aX + cc, aY)

Write(' ')

alpha:=''

gotoxy(aX + cc, aY)

If(cc <> 0) Then For Number:=1 to cc Do alpha:= alpha + store[Number]

End

Else If( (let[0] IN [#32..#126]) AND (cc < CLimit)) Then

Page 12: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

11 | P a g e

Begin # For Acceptable Input Characters

If( input = 0) Then Write(let[0])

Else Write(let[Num])

alpha:= alpha + let[0]

cc:= cc + 1

store[cc]:=let[0]

If(Num < FLimit) Then Num:=Num + 1

Else Num:=1

end if..else statement

Until( (let[0] = #13) AND ( cc > 0) ) # end while loop

if( (lowercase(alpha) = 'exit') AND (SelectProgram <> 1) ) Then Quit

End MODULE Authenticate

4. THIS MODULE GRANTS ACCESS FOR REGISTERED USERS

MODULE Login

Begin

Initialise

max:=0

Error:=0

inpro:='0'

inkey:='0'

Assign(pfile, 'profiles.fung')

{$I-} # Error Checking Disabled

Reset(pfile)

{$I+} # Error Checking Enabled

If( IOResult <> 0) Then

Begin

Rewrite(pfile)

Error:=1

End

Else If(Filesize(pfile) = 0) Then Error:=1

Page 13: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

12 | P a g e

Close(pfile)

If(check = 2) Then

Begin

User.Priority:=1

Error:=1

end if statement

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

If(Error = 1) Then Write('| REGISTERING NEW USER |')

Else Write('| USER SIGNING IN |')

gotoxy(mX, mY + 3)

Write('Enter Username - ')

If(Error <> 1) Then

Begin

gotoxy(mX, mY + 4)

Write('Enter Password - ')

gotoxy(mX, mY + 6)

Write('Attempts Remaining - ')

gotoxy(mX, mY + 8)

Write('-------------------------------------')

End

Else Begin

gotoxy(mX - 3, mY + 4)

Writeln('Re-Enter Username - ')

gotoxy(mX, mY + 6)

Writeln('Enter Password - ')

gotoxy(mX - 3, mY + 7)

Writeln('Re-Enter Password - ')

gotoxy(mX, mY + 9)

Write('-------------------------------------')

User.Priority:=0

Page 14: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

13 | P a g e

end if..else statement

Repeat

gotoxy(mX + 17, mY + 3)

For Number:=1 to CLimit Do Write(' ')

gotoxy(mX + 17, mY + 4)

For Number:=1 to CLimit Do Write(' ')

If(Error = 1) Then

Begin

gotoxy(mX + 17, mY + 6)

For Number:=1 to CLimit Do Write(' ')

gotoxy(mX + 17, mY + 7)

For Number:=1 to CLimit Do Write(' ')

End

Else Begin

gotoxy(mX + 21, mY + 6)

Write(RC - max)

end if..else statement

authenticate(mX + 17, mY + 3, 0, inpro)

If(Error = 1) Then

Begin

authenticate(mX + 17, mY + 4, 0, User.Pro)

authenticate(mX + 17, mY + 6, 1, inkey)

authenticate(mX + 17, mY + 7, 1, User.Key)

End

Else Begin

authenticate(mX + 17, mY + 4, 1, inkey)

Reset(pfile)

While( (EOF(pfile) = False) AND ( ((inkey = User.Key) AND (inpro = User.Pro)) = False ) ) Do

Read(pfile, User)

Close(pfile)

max:= max + 1

end if..else statement

Page 15: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

14 | P a g e

Until ( ((inpro = User.Pro) AND (inkey = User.Key)) OR (max = RC) )

If( (inpro = User.Pro) AND (inkey = User.Key) ) Then

Begin

If( (check = 2) AND (Error = 1) ) Then User.Priority:=1

If(Error = 1) Then

Begin

Reset(pfile)

While( (EOF(pfile) = False) AND ( ((copy.Key = User.Key) AND (copy.Pro = User.Pro)) = False

) ) Do Read(pfile, Copy)

Close(pfile)

If((copy.Key <> User.Key) AND (copy.Pro <> User.Pro)) Then

Begin

Reset(pfile)

Seek(pfile, Filesize(pfile))

Write(pfile, User)

Close(pfile)

End

Else User.Priority:= Copy.Priority

end if statement

If(SelectProgram <> 4) Then Main

End

Else If( max = RC) Then

Begin

gotoxy(mX, mY + 6)

textcolor (Neg)

Write('ATTEMPTS HAVE BEEN EXCEEDED...Program Exiting')

Delay(2000)

end if..else statement

End MODULE Login

Page 16: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

15 | P a g e

5. THIS MODULE DISPLAYS AUTHOR’S NAME MODULE Authoring

Begin

gotoxy(mX - 12, mY)

Write('||||||\\ || |||||\\ |||||\\ ||/ # # ||\\ ||')

gotoxy(mX - 12, mY + 1)

Write(' || || || || || || || || || || \\ ||')

gotoxy(mX - 12, mY + 2)

Write(' || || || || ||||| # ||||| # ||/ # || \\ ||')

gotoxy(mX - 12, mY + 3)

Write(' || || |||||||| || \\ || \\ || || \\ ||')

gotoxy(mX - 12, mY + 4)

Write('|||||| # || || || \\ || \\ ||/ # # || \\||')

gotoxy(mX - 2, mY + 6)

Write('|| # # # || || ||\\ || # |||\\')

gotoxy(mX - 2, mY + 7)

Write('|| || || || \\ || # ||')

gotoxy(mX - 2, mY + 8)

Write('|| # || || || \\ || || ____')

gotoxy(mX - 2, mY + 9)

Write('|| || || || \\ || \\ ||')

gotoxy(mX - 2, mY + 10)

Write('|| |||||| || \\|| \\||||||')

End MODULE Authoring

Page 17: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

16 | P a g e

6. THIS MODULE HAVE ALL THE TABLE HEADERS (SEPARATE FROM OTHER MODULES FOR SIMPLICITY)

MODULE TableHeader

Begin

CALL MODULE Initialise

Case SelectProgram of

2: Begin

Case check of

1: textcolor (Earth)

2: textcolor (Volcano)

3: textcolor (Ice)

4: textcolor (Tornado)

5: textcolor (Lightning)

6: textcolor (LText)

end case statement

If( check IN [1..5] ) Then

Begin

gotoxy(mX, mY)

Write('|', check:15, ' - ', SecName[check], '|':(18 - Length(SecName[check])) )

gotoxy(mX, mY + 1)

Write('-------------------------------------')

gotoxy(mX, mY + 2)

Write('| FIRSTNAME | SURNAME |')

gotoxy(mX, mY + 3)

Write('-------------------------------------')

End

Else Begin

gotoxy(mX - 15, mY + 1)

Write('-----------------------------------------------------------------')

gotoxy(mX - 15, mY + 2)

Write('| FIRSTNAME | SURNAME | SECTION |')

Page 18: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

17 | P a g e

gotoxy(mX - 15, mY + 3)

Write('-----------------------------------------------------------------')

end if..else statement

End

3: Begin

gotoxy(mX - 8, mY)

Write('----------------------------------------------------')

gotoxy(mX - 8, mY + 1)

Write('| SECTION | NO. REGISTER | TOTAL AMOUNT |')

gotoxy(mX - 8, mY + 2)

Write('----------------------------------------------------')

End

4: Begin

If(check = -1) Then

Begin

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| MODIFYING STORAGE FILES |')

gotoxy(mX, mY + 2)

Write('-------------------------------------')

End

Else If(check = 1) Then

Begin

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| DELETING USER FILES |')

gotoxy(mX, mY + 2)

Write('-------------------------------------')

End

Else If(check = 2) Then

Page 19: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

18 | P a g e

Begin

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| DELETING STORAGE FILES |')

gotoxy(mX, mY + 2)

Write('-------------------------------------')

end if..else statement

End

end case statement

End MODULE TableHeader

7. THIS MODULE OBTAINS AND STORES DATA ON A MASQUERADER

MODULE Registery

Begin

CALL MODULE Initialise

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| Register A Person - Enter Name |')

gotoxy(mX, mY + 3)

Write('| First Name : |')

gotoxy(mX, mY + 4)

Write('| Surname : |')

gotoxy(mX, mY + 5)

Write('| Amount Paid : |')

textcolor (Choice)

Authenticate(mX + 18, mY + 3, 0, Person[0].First)

Authenticate(mX + 18, mY + 4, 0, Person[0].Surname)

textcolor (LText)

Page 20: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

19 | P a g e

gotoxy(mX, mY + 7)

Write('| Options For Amount Paid $TTD$ |')

max:= mY + 8

gotoxy(mX - 6, mY + 9)

Write('|----FULL PAYMENT----|')

gotoxy(mX + 18, mY + 9)

Write('|--INSTALLMENT PAYMENT--|')

For Number:=1 to (2 * SLimit) Do

Begin

If( (Number MOD 2) = 0) Then

Begin

gotoxy(mX + 18, mY + 10 + (Number DIV 2) )

Write('| ', Number:2,' - $', Currency, ' ', icost[Number]:Dcostlength:Ccostlength, ' |') #

Installments

End

Else Begin

gotoxy(mX - 6, mY + 11 + (Number DIV 2) )

Write('| ', Number:2,' - $', Currency, ' ', fcost[Number]:Dcostlength:Ccostlength,' |') # Full

end if statement

end for loop

gotoxy(mX - 6, mY + 7 + Number)

Write('-------------------------------------------------')

gotoxy(mX, mY + 9 + Number)

Write('| 0 - Discard & Return To Menu |')

textcolor (LText)

gotoxy(mX, mY + 1)

Write('| Registering - Enter Amount Option |')

Repeat

textcolor (Choice)

VerfiyInt(mX + 18, mY + 5, check)

textcolor (Neg)

gotoxy(mX, mY + 1)

Page 21: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

20 | P a g e

Write('| Amount Option Out Of Range |')

Until( check IN [0..10] )

CALL MODULE Initialise

If(check <> 0) Then

Begin

With Person[0] Do

Begin

# Get Amount Paid

If( (check MOD 2) = 0) Then AmtPd:= icost[check]

Else AmtPd:= fcost[check]

If( (check MOD 2) = 1) Then check:= check + 1

Sections:= check DIV 2

end with statement

Reset(Datafile)

max:= 0

Error:= 0

Person[1].ID:= -1

while( EOF(Datafile) = false) Do

Begin

Read(Datafile, Person[1])

if(Person[1].Sections = Person[0].Sections) Then max:= max + 1

end while

Close(Datafile)

Person[0].ID:=Person[1].ID + 1

if( (max >= PLimit) AND (Null = 1) ) Then Error:= 1

With Person[0] Do

Begin

gotoxy(mX, mY)

Write(' Name - ', First)

gotoxy(mX, mY + 1)

Write(' Surname - ', Surname)

gotoxy(mX, mY + 2)

Page 22: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

21 | P a g e

Write('Amount Paid - $', Currency, ' ', AmtPd:Dcostlength:Ccostlength)

gotoxy(mX, mY + 4)

Write(' Section - ', Sections, ' = ',SecName[Sections])

if(Error = 0) Then

Begin

gotoxy(mX, mY + 6)

Writeln(' Confirm - ')

gotoxy(mX, mY + 8)

Writeln(' 0 - No... Re-Enter Data')

gotoxy(mX, mY + 10)

Writeln(' 1 - Yes.. Save Data')

textcolor (Choice)

Repeat VerfiyInt(mX + 14, mY + 6, check)

Until( (check = 0) OR (check = 1) )

if(check = 1) Then

Begin

Reset(Datafile)

Seek(Datafile, ID)

Write(Datafile, Person[0])

Close(Datafile)

SelectProgram:= 0

End

Else SelectProgram:= 1

End

Else Begin

textcolor (Neg)

gotoxy(mX + 10, mY + 6)

Write(' Section ',Sections,' Is Full !')

gotoxy(mX + 5, mY + 7)

Write(' Information Can Not Be Stored')

gotoxy(mX - 2, mY + 9)

textcolor (LText)

Page 23: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

22 | P a g e

Write(' Press Any Key To Return To Main Menu')

Readkey

SelectProgram:=0

end if statement

end with statement

End

Else SelectProgram:= 0

End MODULE Registery

8. THIS MODULE DISPLAYS REGISTERED MASQUERADERS IN THEIR

DESIGNATED SECTION

MODULE ListSecName

Begin

Repeat

CALL MODULE Initialise

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| View Masqueraders @ Section - |')

For Number:=1 to SLimit Do

Begin

gotoxy(mX, mY + 2 + Number)

Write('| ',Number,' - ',SecName[Number]:12,' = Section ', Number,' |')

end for Loop

gotoxy(mX, mY + 3 + Number)

Write('| 6 - View All Masqueraders |')

gotoxy(mX, mY + 5 + Number)

Write('-------------------------------------')

xx:=33

Repeat

textcolor (Choice)

Page 24: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

23 | P a g e

VerfiyInt(mX + xx, mY + 1, check)

textcolor (Neg)

gotoxy(mX, mY + 1)

Write('| Invalid Option Number - |')

xx:=26

Until( check IN [1..6] )

TableHeader

reset(Datafile)

For Number:=1 to SLimit Do i[Number]:=0

max:=0

Print:=0

With Person[0] Do

Begin

While( EOF(Datafile) = false )Do

Begin

Read(Datafile, Person[0])

If( (Sections = check) OR (check = 6) ) Then

Begin

Case Sections of

1: textcolor (Earth)

2: textcolor (Volcano)

3: textcolor (Ice)

4: textcolor (Tornado)

5: textcolor (Lightning)

end case statement

If(Null = 1) Then

Begin

If( (max < PLimit) AND (i[Sections] < PLimit) ) Then

Begin

If(check = 6) Then gotoxy(mX - 12, mY + 5 + Print)

Else gotoxy(mX + 2, mY + 5 + Print)

Page 25: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

24 | P a g e

Write(First)

If(check = 6) Then gotoxy(mX + 12, mY + 5 + Print)

Else gotoxy(mX + 22, mY + 5 + Print)

Write(Surname)

If(check = 6) Then

Begin

gotoxy(mX + 32, mY + 5 + Print)

Write(Sections, ' - ', SecName[Sections])

i[Sections]:= i[Sections] + 1

End

end if statement

End

Else Begin

If(check = 6) Then gotoxy(mX - 6, mY + 5 + Print)

Else gotoxy(mX + 2, mY + 5 + Print)

Write(First)

If(check = 6) Then gotoxy(mX + 15, mY + 5 + Print)

Else gotoxy(mX + 22, mY + 5 + Print)

Write(Surname)

If(check = 6) Then

Begin

gotoxy(mX + 37, mY + 5 + Print)

Write(Sections, ' - ', SecName[Sections])

i[Sections]:= i[Sections] + 1

end if..else statement

end if..else statement

max:= max + 1

Print:= Print + 1

end if statement

If( ( EOF(Datafile) = false ) AND (Print = PrintLimit) ) Then

Begin

textcolor (LText)

Page 26: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

25 | P a g e

if(check <> 6) Then

Begin

gotoxy(mX, mY + 6 + Print)

Write('-------------------------------------')

End

Else Begin

gotoxy(mX - 15, mY + 6 + Print)

Write('-----------------------------------------------------------------')

end if..else statement

gotoxy(mX - 12, mY + 8 + Print)

Write('Screen Limit Exceeded..Press Any Key To Continue Displaying ')

Readkey

TableHeader

Print:= 0

end if statement

end while loop

end with

close(Datafile)

if( max = 0) Then

Begin

gotoxy(mX + 6, mY + 5 + Print)

Write('No One Has Been Registered')

gotoxy(mX + 6, mY + 6 + Print)

if( check <> 6 ) Then

Begin

Write('To Play In This Section')

Print:= Print + 1

end if statement

max:= max + 2

End

Else Print:= Print - 1

if(check <> 6) Then

Page 27: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

26 | P a g e

Begin

gotoxy(mX, mY + 7 + Print)

Write('-------------------------------------')

End

Else Begin

textcolor (LText)

gotoxy(mX - 15, mY + 7 + Print)

Write('-----------------------------------------------------------------')

end if..else statement

textcolor (LText)

If(check = 6) Then Print:= Print - 1

gotoxy(mX, mY + 12 + Print)

Write('0 - View Masqueraders @ Section')

gotoxy(mX, mY + 13 + Print)

Write('1 - Return To Main Menu')

gotoxy(mX, mY + 10 + Print)

Write('Enter Option Number - ')

textcolor (Choice)

Repeat VerfiyInt(mX + 22, mY + 10 + Print, check) Until( (check = 0) OR (check = 1) )

Until(check = 1) # end repeat loop

SelectProgram:= 0

End MODULE ListSecName

Page 28: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

27 | P a g e

9. THIS MODULE DEISPLAYS THE TOTAL AMOUNT REGISTERED

MASQUERADERS AND TOTAL AMOUNT OF MONEY EARNED IN EACH

SECTION

MODULE ListSecAmt

Begin

CALL MODULE Initialise

For Number:=1 to SLimit Do

Begin

TotalAmount[Number]:= 0

i[Number]:= 0

End

TableHeader

reset(Datafile)

While( EOF(Datafile) = false) Do

Begin

Read(Datafile, Person[0])

With Person[0] Do

Begin

If(Null = 1) Then

Begin

If(i[Sections] < PLimit)Then

Begin

# Total Persons Registered

i[Sections]:= i[Sections] + 1

TotalAmount[Sections]:= TotalAmount[Sections] + AmtPd

End

End

Else Begin

i[Sections]:= i[Sections] + 1

TotalAmount[Sections]:= TotalAmount[Sections] + AmtPd

end if..else statement

end with statement

Page 29: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

28 | P a g e

end while loop

close(Datafile)

For Number:= 1 to SLimit Do

Begin

Gotoxy(mX - 8, mY + 3 + Number)

Case Number of

1: textcolor (Earth)

2: textcolor (Volcano)

3: textcolor (Ice)

4: textcolor (Tornado)

5: textcolor (Lightning)

End

Write( '| ', Number, ' - ', SecName[Number] )

gotoxy( mX + 16, mY + 3 + Number)

Write( i[Number]:3 )

gotoxy( mX + 28, mY + 3 + Number)

Write( '$', Currency, ' ', TotalAmount[Number]:Dcostlength:Ccostlength, ' |')

end for loop

textcolor (LText)

gotoxy(mX - 8, mY + 5 + Number)

Write('----------------------------------------------------')

gotoxy(mX, mY + 7 + Number)

Write('Press Any Key To Return To Main Menu ')

Readkey

SelectProgram:= 0

End MODULE ListSecAmt

Page 30: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

29 | P a g e

10. THIS MODULE DELETES STORAGE FILES (CLEAR DATA STORED ON SECTIONS OR REGISTERD USERS)

MODULE DeleteFile # Deleting Of Storage Files

Begin

check:= -1

textcolor (LText)

TableHeader

gotoxy(mX, mY + 4)

Write('| Enter Option Number - |')

gotoxy(mX, mY + 6)

Write('| 1 - Delete All Users |')

gotoxy(mX, mY + 8)

Write('| 2 - Delete All Masqueraders |')

gotoxy(mX, mY + 10)

Write('-------------------------------------')

textcolor (choice)

Repeat VerfiyInt(mX + 27, mY + 4, check)

Until( (check = 1) OR (check = 2) )

max:=check

textcolor (Neg)

TableHeader

gotoxy(mX, mY + 4)

If(check = 1) Then Write('| ALL USERS WILL BE DELETED |')

Else Write('| ALL RECORDS WILL BE DELETED |')

gotoxy(mX, mY + 6)

Write('| CONFIRM : ARE YOU SURE ? - |')

gotoxy(mX, mY + 8)

Write('| 0 - NO |')

gotoxy(mX, mY + 9)

Write('| 1 - YES |')

gotoxy(mX, mY + 11)

Page 31: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

30 | P a g e

Write('-------------------------------------')

textcolor (choice)

Repeat VerfiyInt(mX + 30, mY + 6, check)

Until( (check = 0) OR (check = 1) )

Number:=check

check:=max

TableHeader

check:=Number

textcolor (Pos)

If(check = 0) Then

Begin

gotoxy(mX, mY + 4)

Write('| DELETE CANCELLED |')

End

Else Begin

gotoxy(mX, mY + 4)

Write('| DELETE CONFIRMED |')

If(max = 1) Then

Begin

Assign(pfile, 'Profiles.fung')

Rewrite(pfile)

Close(pfile)

End

Else Begin

Rewrite(Datafile)

Close(Datafile)

end if..else statment

end if..else statement

textcolor (LText)

gotoxy(mX, mY + 8)

Write('-------------------------------------')

gotoxy(mX, mY + 6)

Page 32: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

31 | P a g e

Write('Press Any Key To Return To Main Menu')

Readkey

If( (max = 1) AND (check = 1) ) Then Login

SelectProgram:= 0

End MODULE DeleteFile

11. THIS MODULE DISPLAYS AN EXITING SCREEN

MODULE Quit

Begin

CALL MODULE Initialise

Clrscr

gotoxy(mX, mY)

Write('-------------------------------------')

textcolor (Neg)

gotoxy(mX, mY + 2)

Write('| PRORGRAM SHUTTING DOWN |')

textcolor (Brand)

gotoxy(mX, mY + 5)

Write('| TRINI REVELERS 2015 |')

textcolor (Author)

gotoxy(mX, mY + 8)

Write('| POWERED BY DARREN FUNG |')

textcolor (LText)

gotoxy(mX, mY + 10)

Write('-------------------------------------')

Delay(2500)

Halt

End MODULE Quit

Page 33: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

32 | P a g e

12. THIS MODULE IS THE MAIN SCREEN OF PROGRAM AND RUNS

SPECIFIED MODULE BY USER (DISPLAYS ALL THE AVAILABLE OPTIONS FOR USER TO SELECT FROM)

MODULE Main

Begin

CALL MODULE Initialise

gotoxy(mX, mY)

Write('-------------------------------------')

gotoxy(mX, mY + 1)

Write('| Enter Option Number - |')

gotoxy(mX, mY + 3)

If(User.Priority IN [0,1]) Then Write('| 1 - Register New Masquerader |')

gotoxy(mX, mY + 4)

Write('| 2 - View Masqueraders @ Section |')

gotoxy(mX, mY + 5)

Write('| 3 - View Total Amount @ Section |')

gotoxy(mX, mY + 6)

If(User.Priority = 0) Then Write('| 4 - Modify Storage File |')

gotoxy(mX, mY + 7)

Write('| 5 - Quit Program |')

gotoxy(mX, mY + 9)

Write('-------------------------------------')

Repeat

textcolor (Choice)

VerfiyInt(mX + 26, mY + 1, SelectProgram)

textcolor (Neg)

gotoxy(mX, mY + 1)

If( (User.Priority = 1) AND (SelectProgram IN [4]) ) Then SelectProgram:=0

Else If( (User.Priority = 2) AND (SelectProgram IN [1,4]) ) Then SelectProgram:=0

Write('| Invalid Option Number - |')

Until( SelectProgram IN [1..5] )

Page 34: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

33 | P a g e

Repeat

Case SelectProgram of

0: Main

1: Registery

2: ListSecName

3: ListSecAmt

4: DeleteFile

end case statement

Until(SelectProgram = 5)

End MODULE Main

13. THIS MODULE DISPLAYS THE WELCOME SCREEN AND INITIALISES

CORE VARIABLES

MODULE Boot

Begin

SecName[1]:= 'Earth'

SecName[2]:= 'Volcano'

SecName[3]:= 'Ice'

SecName[4]:= 'Tornado'

SecName[5]:= 'Lightning'

fcost[1]:= 936.00

icost[2]:= 1196.00

fcost[3]:= 1326.00

icost[4]:= 1586.00

fcost[5]:= 1716.00

icost[6]:= 1976.00

fcost[7]:= 2171.00

icost[8]:= 2431.00

fcost[9]:= 2658.50

icost[10]:= 2918.50

Clrscr

Page 35: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

34 | P a g e

textcolor (Author)

CALL MODULE Authoring

gotoxy(1, 1)

Delay(1000)

textcolor (LText)

Writeln(' Searching For Storage File')

assign(Datafile,'Datafile.fung')

{$I-}

reset(Datafile)

{$I+}

Delay(1000)

If( IOResult <> 0) Then

Begin

textcolor (Neg)

CALL MODULE Authoring

gotoxy( mX - 12, mY + 12)

Writeln('"Datafile.fung" File Is Mssing ! ... New File Will Be Created')

rewrite(Datafile)

End

Else Begin

textcolor (Pos)

CALL MODULE Authoring

gotoxy(mX + 6, mY + 12)

Writeln('"Datafile.fung" File Is Found')

end if..else statement

close(Datafile)

textcolor (Neg)

Writeln

If(Null = 1)Then

Begin

Writeln(' NOTE : A Maximum Of ',PLimit,' Persons Per Section Can Be Recorded ! ')

Writeln

Page 36: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

35 | P a g e

end if statement

textcolor (LText)

Writeln(' Enter Option Number')

Writeln

Writeln(' Sign In - 1 Register - 2 Guest - 3 Exit - 0')

Repeat

val(Readkey, check, i)

If( i <> 0) Then check:= -1

Until (check IN [0..3])

User.Priority:=2

If(check IN [1,2]) Then Login

Else If(check = 3) Then Main

Else Quit

End MODULE Boot

14. MAIN PROGRAM SHOULD RESEMBLE THIS Begin

Initialise

Boot

Quit

End.

Page 37: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

36 | P a g e

7. DRY RUNNING THE ALGORITHM WITH TRACE TABLE

1. LISTING THE MASQUERADERS FROM DATABASE TO BE USED TO

TEST ALGORITHM ID NUMBER (DATABASE)

SURNAME FIRST NAME AMOUNT PAID

1 Rai Kavita $1196.00 6 Star Patrick $936.00

15 Jones Fred $1586.00 18 Krab Eugene $1326.00 30 Puff Fish $1716.00 33 Lopez George $1976.00 43 Plankton Sheldon $2171.00 46 Falcon Kim $2431.00 55 Crawford Lindon $2918.50 56 Badgenatsing Reese $2658.50

2. OPTION 1 – REGISTER NEW MASQUERADER FIRST NAME SURNAME AMOUNT PAID SECTION PLACED

Kavita Rai 2 1

Patrick Star 1 1

Fred Jones 4 2

Eugene Krab 3 2

Fish Puff 5 3

George Lopez 6 3

Sheldon Plankton 7 4

Kim Falcon 8 4

Lindon Crawford 10 5

Reese Badgenatsing 9 5

3. OPTION 2 – VIEW MASQUERADERS @ SECTION

OPTION 1 – EARTH = SECTION 1

SURNAME FIRST NAME Rai Kavita Star Patrick

OPTION 2 – VOLCANO = SECTION 2

SURNAME FIRST NAME Jones Fred Krab Eugene

OPTION 3 – ICE = SECTION 3

SURNAME FIRST NAME Puff Fish

Lopez George

Page 38: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

37 | P a g e

OPTION 4 – TORNADO = SECTION 4

SURNAME FIRST NAME Plankton Sheldon

Falcon Kim

OPTION 5 – LIGHTNING = SECTION 5

SURNAME FIRST NAME Crawford Lindon

Badgenatsing Reese

OPTION 6 – VIEW ALL MASQUERADERS

SURNAME FIRST NAME

Kavita Rai

Patrick Star

Fred Jones

Eugene Krab

Fish Puff

George Lopez

Sheldon Plankton

Kim Falcon

Lindon Crawford

Reese Badgenatsing

4. OPTION 3 – VIEW TOTAL AMOUNT @ SECTION SECTION NUMBER REGISTER TOTAL AMOUNT

1 – EARTH 2 $2132.00 2 – VOLCANO 2 $2912.00

3 – ICE 2 $3692.00 4 – TORNADO 2 $4602.00 5 - LIGHTNING 2 $5577.00

5. OPTION 4 – MODIFY STORAGE FILES OPTION 1 - When Selected, User Will Be Prompted To Confirm Deletion Of All Registered Users.

OPTION 2 - When Selected, User Will Be Prompted To Confirm Deletion Of All Masqueraders.

Page 39: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

38 | P a g e

6. OPTION 5 – QUIT PROGRAM When Selected, The Program Shuts Down (Exits).

8. PROGRAM CODE (*

Name Of Author: Darren Fung School: Presentation College Chaguanas

Program: IT SBA 2015

This Program accepts as input the names of an unspecified number of

masqueraders who each have paid the full cost of their costume and the amount

each has paid. A masquerader may have paid for a costume in any of the five

sections in the band. The Program also determines the section in which a

masquerader plays based on the amount he/she has paid for the costume. In

addition to this, The Program determines the number of masqueraders who have

paid for costumes in each section. The names of persons and the section for

which they have paid are printed. A listing of section and the total

number of persons registered to play in each section are also printed, along

with the total amount of money paid in each section.

*)

Program TriniRevelers;

Uses crt;

Const

mX = 21; //Draw Offset From Left

mY = 3; //Draw Offset From Top

Dcostlength = 8; //Display Of Money

Ccostlength = 2; //Display Cents

Currency = 'TT'; //Currency Of Money

Null = 0; //Removes PLimit If [Null <> 1]

SLimit = 5; //Max Sections

PLimit = 15; //Max Person Per Section

CLimit = 18; //Max Character Input

Page 40: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

39 | P a g e

//Colours

Choice = 13; //User Data

LText = 15; //Display

Neg = 12; //Bad

Pos = 10; //Good

Numeral = 2; //Numerals (No Available Use Found)

Brand = 14; //Name Of Band

Author = 13; //Name Of Programmer

//Sections

Earth = 14;

Volcano = 12;

Ice = 11;

Tornado = 7;

Lightning = 3;

(*

Black = 0 ; DarkBlue = 1;

DarkGreen = 2 ; DarkCyan = 3;

DarkRed = 4 ; Magenta = 5;

Brown = 6 ; LightGrey = 7;

DarkGrey = 8 ; LightBlue = 9;

LightGreen = 10 ; Cyan = 11;

LightRed = 12 ; LightMagenta = 13;

Yellow = 14 ; White = 15; *)

Type

PersonType = record //Information To Be Stored

ID, Sections:integer;

AmtPd:real;

Surname, First:string[20];

End;

StorageFile = file of PersonType;

Profile = record //User Profile Infomation

Page 41: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

40 | P a g e

Priority:integer;

Pro, Key:string;

End;

Var

check, SelectProgram:integer;

SecName:array[1..SLimit] of string;

icost, fcost:array[1..10] of real;

Datafile:Storagefile;

User:Profile;

(*

--Commonly Used Variables--

check - Answer From User

SelectProgram - Runs Desired Procedure

SecName - Holds The Name Of Each Section

Datafile - The Storage File

--Commonly Used Procedure Variables--

max - Temporary Storage Of Data To Use Later

Number - Integer For Loops Or Portions Of Codes To Use

Error - For Availble Space In Each Section

Person - Information About Person

i - For Controlling "Person Array" Of Each Section

TotalAmount - Holds The Total Amount Of Each Section

Print - Count For Number Of Outputs

Use - Number Array Person Allocates

temp - Temporary Storage File

alpha - For Strings Manipulation

let - Storage Of Characters

cc - Character Count

*)

//Forward Subprograms

Page 42: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

41 | P a g e

Procedure Main;forward;

Procedure Quit;forward;

(*--------------------------------------------------------------------------*)

Procedure Initialise;//For Setting Screen

Const

Border = 4; //Border

BG = 1; //Background

Var Number:integer;

Begin

textBackground (BG);

clrscr;

//Titling

textBackground (Border);

textcolor (Border);

gotoxy(1, 1);

For Number:=1 to 80 Do Write('_');

For Number:=1 to 25 Do

Begin

gotoxy(1, Number);

Write('_-');

gotoxy(79, Number);

Write('_-');

End;//end for loop

gotoxy(1, 1);

For Number:=1 to 80 Do Write('_');

gotoxy(mX + 1, 1);

textcolor (Brand);

Write('TRINI REVELERS 2015 ');

textcolor (LText);

Page 43: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

42 | P a g e

Write('BY ');

textcolor (Author);

Write('DARREN FUNG');

textBackground (BG);

textcolor (LText);

End;//End Procedure Initialise

(*--------------------------------------------------------------------------*)

Procedure VerfiyInt (aX, aY:integer; VAR num:integer);//For Accepting Integer Values Only

Const CLimit = 3;

Var

let:array[0..CLimit] of char;

Number, cc:integer;

alpha:string;

Begin

gotoxy(aX, aY);

For Number:=1 to CLimit Do Write(' ');

alpha:='';

cc:=0;

gotoxy(aX, aY);

Repeat

let[0]:=Readkey;

If( (let[0] = #8) AND (cc > 0) ) Then

Begin//For Backspacing

cc:= cc - 1;

gotoxy(aX + cc, aY);

Write(' ');

alpha:='';

gotoxy(aX + cc, aY);

If(cc > 0) Then For Number:=1 to cc Do alpha:=alpha + let[Number];

End

Page 44: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

43 | P a g e

Else If( (lowercase(let[0]) IN ['0'..'9']) AND (cc < CLimit) ) Then

Begin//For Acceptable Input Characters

cc:=cc + 1;

Write(let[0]);

alpha:=alpha + let[0];

let[cc]:=let[0];

End;//end if..else statement

Until( (let[0] = #13) AND (cc > 0) );//end repeat loop

Val(alpha, num, Number);

If(Number <> 0) Then num:= -1;

End;//End Procedure VerfiyInt

(*--------------------------------------------------------------------------*)

Procedure Authenticate (aX, aY, input:integer; VAR alpha:string);//For Accepting Alphanumeric Values Only

Const FLimit = 9;

Var

let, store:array[0..CLimit] of char;

Number, cc, num:integer;

Begin

let[0]:=' ';

let[1]:='R';

let[2]:='E';

let[3]:='V';

let[4]:='E';

let[5]:='L';

let[6]:='L';

let[7]:='E';

let[8]:='R';

let[9]:='S';

num:=1;

cc:=0;

alpha:='';

Page 45: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

44 | P a g e

gotoxy(aX, aY);

Repeat

let[0]:=Readkey;

If( (let[0] = #8) AND (cc > 0) ) Then

Begin//For backspacing

cc:= cc - 1;

If(num > 1) Then num:= num - 1

Else num:=FLimit;

gotoxy(aX + cc, aY);

Write(' ');

alpha:='';

gotoxy(aX + cc, aY);

If(cc <> 0) Then For Number:=1 to cc Do alpha:= alpha + store[Number];

End

Else If( (let[0] IN [#32..#126]) AND (cc < CLimit)) Then

Begin//For Acceptable Input Characters

If( input = 0) Then Write(let[0])

Else Write(let[Num]);

alpha:= alpha + let[0];

cc:= cc + 1;

store[cc]:=let[0];

If(Num < FLimit) Then Num:=Num + 1

Else Num:=1;

End;//end if..else statement

Until( (let[0] = #13) AND ( cc > 0) );//end while loop

if( (lowercase(alpha) = 'exit') AND (SelectProgram <> 1) ) Then Quit;

End;//End Procedure Authenticate

(*--------------------------------------------------------------------------*)

Procedure Login;//Grant Access For Registered Users

Const RC = 3;

Type pfiles = file of Profile;

Page 46: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

45 | P a g e

Var

inpro, inkey:string;

max, Number, Error:integer;

copy:Profile;

pfile:pfiles;

Begin

Initialise;

max:=0;

Error:=0;

inpro:='0';

inkey:='0';

Assign(pfile, 'profiles.fung');

{$I-} // Error Checking Disabled

Reset(pfile);

{$I+} // Error Checking Enabled

If( IOResult <> 0) Then

Begin

Rewrite(pfile);

Error:=1;

End

Else If(Filesize(pfile) = 0) Then Error:=1;//end if..else statement

Close(pfile);

If(check = 2) Then

Begin

User.Priority:=1;

Error:=1;

End;//end if statement

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

If(Error = 1) Then Write('| REGISTERING NEW USER |')

Else Write('| USER SIGNING IN |');

Page 47: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

46 | P a g e

gotoxy(mX, mY + 3);

Write('Enter Username - ');

If(Error <> 1) Then

Begin

gotoxy(mX, mY + 4);

Write('Enter Password - ');

gotoxy(mX, mY + 6);

Write('Attempts Remaining - ');

gotoxy(mX, mY + 8);

Write('-------------------------------------');

End

Else Begin

gotoxy(mX - 3, mY + 4);

Writeln('Re-Enter Username - ');

gotoxy(mX, mY + 6);

Writeln('Enter Password - ');

gotoxy(mX - 3, mY + 7);

Writeln('Re-Enter Password - ');

gotoxy(mX, mY + 9);

Write('-------------------------------------');

User.Priority:=0;

End;//end if..else statement

Repeat

gotoxy(mX + 17, mY + 3);

For Number:=1 to CLimit Do Write(' ');

gotoxy(mX + 17, mY + 4);

For Number:=1 to CLimit Do Write(' ');

If(Error = 1) Then

Begin

gotoxy(mX + 17, mY + 6);

Page 48: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

47 | P a g e

For Number:=1 to CLimit Do Write(' ');

gotoxy(mX + 17, mY + 7);

For Number:=1 to CLimit Do Write(' ');

End

Else Begin

gotoxy(mX + 21, mY + 6);

Write(RC - max);

End;//end if..else statement

authenticate(mX + 17, mY + 3, 0, inpro);

If(Error = 1) Then

Begin

authenticate(mX + 17, mY + 4, 0, User.Pro);

authenticate(mX + 17, mY + 6, 1, inkey);

authenticate(mX + 17, mY + 7, 1, User.Key);

End

Else Begin

authenticate(mX + 17, mY + 4, 1, inkey);

Reset(pfile);

While( (EOF(pfile) = False) AND ( ((inkey = User.Key) AND (inpro = User.Pro)) = False ) ) Do

Read(pfile, User);

Close(pfile);

max:= max + 1;

End;//end if..else statement

Until ( ((inpro = User.Pro) AND (inkey = User.Key)) OR (max = RC) );//end repeat loop

If( (inpro = User.Pro) AND (inkey = User.Key) ) Then

Begin

If( (check = 2) AND (Error = 1) ) Then User.Priority:=1;

If(Error = 1) Then

Begin

Reset(pfile);

While( (EOF(pfile) = False) AND ( ((copy.Key = User.Key) AND (copy.Pro = User.Pro)) = False ) )

Do Read(pfile, Copy);

Page 49: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

48 | P a g e

Close(pfile);

If((copy.Key <> User.Key) AND (copy.Pro <> User.Pro)) Then

Begin

Reset(pfile);

Seek(pfile, Filesize(pfile));

Write(pfile, User);

Close(pfile);

End

Else User.Priority:= Copy.Priority;

End;//end if statement

If(SelectProgram <> 4) Then Main;

End

Else If( max = RC) Then

Begin

gotoxy(mX, mY + 6);

textcolor (Neg);

Write('ATTEMPTS HAVE BEEN EXCEEDED...Program Exiting');

Delay(2000);

End;//end if..else statement

End;//End Procedure Login

(*--------------------------------------------------------------------------*)

Procedure Authoring;//Output Author's Name

Begin

gotoxy(mX - 12, mY);

Write('||||||\\ || |||||\\ |||||\\ ||///// ||\\ ||');

gotoxy(mX - 12, mY + 1);

Write(' || || || || || || || || || || \\ ||');

gotoxy(mX - 12, mY + 2);

Write(' || || || || |||||// |||||// ||/// || \\ ||');

gotoxy(mX - 12, mY + 3);

Page 50: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

49 | P a g e

Write(' || || |||||||| || \\ || \\ || || \\ ||');

gotoxy(mX - 12, mY + 4);

Write('||||||// || || || \\ || \\ ||///// || \\||');

gotoxy(mX - 2, mY + 6);

Write('||////// || || ||\\ || //|||\\');

gotoxy(mX - 2, mY + 7);

Write('|| || || || \\ || // ||');

gotoxy(mX - 2, mY + 8);

Write('||// || || || \\ || || ____');

gotoxy(mX - 2, mY + 9);

Write('|| || || || \\ || \\ ||');

gotoxy(mX - 2, mY + 10);

Write('|| |||||| || \\|| \\||||||');

End;//End Procedure Authoring

(*--------------------------------------------------------------------------*)

Procedure TableHeader;//All The Table Headers

Begin

Initialise;

Case SelectProgram of

2: Begin

Case check of

1: textcolor (Earth);

2: textcolor (Volcano);

3: textcolor (Ice);

4: textcolor (Tornado);

5: textcolor (Lightning);

Page 51: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

50 | P a g e

6: textcolor (LText);

End;//end case statement

If( check IN [1..5] ) Then

Begin

gotoxy(mX, mY);

Write('|', check:15, ' - ', SecName[check], '|':(18 - Length(SecName[check])) );

gotoxy(mX, mY + 1);

Write('-------------------------------------');

gotoxy(mX, mY + 2);

Write('| FIRSTNAME | SURNAME |');

gotoxy(mX, mY + 3);

Write('-------------------------------------');

End

Else Begin

gotoxy(mX - 15, mY + 1);

Write('-----------------------------------------------------------------');

gotoxy(mX - 15, mY + 2);

Write('| FIRSTNAME | SURNAME | SECTION |');

gotoxy(mX - 15, mY + 3);

Write('-----------------------------------------------------------------');

End;//end if..else statement

End;

3: Begin

gotoxy(mX - 8, mY);

Write('----------------------------------------------------');

gotoxy(mX - 8, mY + 1);

Write('| SECTION | NO. REGISTER | TOTAL AMOUNT |');

Page 52: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

51 | P a g e

gotoxy(mX - 8, mY + 2);

Write('----------------------------------------------------');

End;

4: Begin

If(check = -1) Then

Begin

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| MODIFYING STORAGE FILES |');

gotoxy(mX, mY + 2);

Write('-------------------------------------');

End

Else If(check = 1) Then

Begin

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| DELETING USER FILES |');

gotoxy(mX, mY + 2);

Write('-------------------------------------');

End

Else If(check = 2) Then

Begin

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| DELETING STORAGE FILES |');

gotoxy(mX, mY + 2);

Page 53: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

52 | P a g e

Write('-------------------------------------');

End;//end if..else statement

End;

End;//end case statement

End;//End Procedure TableHeader;

(*--------------------------------------------------------------------------*)

Procedure Registery;//Obtain & Store Data On A Person

Const Use = 1;

Var

Error, max, Number:integer;

Person:array[0..Use] of PersonType;

Begin

Initialise;

//Get Name And Amount Paid From User

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| Register A Person - Enter Name |');

gotoxy(mX, mY + 3);

Write('| First Name : |');

gotoxy(mX, mY + 4);

Write('| Surname : |');

gotoxy(mX, mY + 5);

Write('| Amount Paid : |');

Page 54: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

53 | P a g e

//Get Valid Input Names From User

textcolor (Choice);

Authenticate(mX + 18, mY + 3, 0, Person[0].First);

Authenticate(mX + 18, mY + 4, 0, Person[0].Surname);

textcolor (LText);

gotoxy(mX, mY + 7);

Write('| Options For Amount Paid $TTD$ |');

max:= mY + 8;

gotoxy(mX - 6, mY + 9);

Write('|----FULL PAYMENT----|');

gotoxy(mX + 18, mY + 9);

Write('|--INSTALLMENT PAYMENT--|');

For Number:=1 to (2 * SLimit) Do

Begin

If( (Number MOD 2) = 0) Then

Begin

gotoxy(mX + 18, mY + 10 + (Number DIV 2) );

Write('| ', Number:2,' - $', Currency, ' ', icost[Number]:Dcostlength:Ccostlength, ' |');

//Installments

End

Else Begin

gotoxy(mX - 6, mY + 11 + (Number DIV 2) );

Write('| ', Number:2,' - $', Currency, ' ', fcost[Number]:Dcostlength:Ccostlength,' |'); //Full

End;//end if statement

End;//end for loop

gotoxy(mX - 6, mY + 7 + Number);

Write('-------------------------------------------------');

gotoxy(mX, mY + 9 + Number);

Write('| 0 - Discard & Return To Menu |');

Page 55: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

54 | P a g e

//Gets Valid Input Amount From User

textcolor (LText);

gotoxy(mX, mY + 1);

Write('| Registering - Enter Amount Option |');

Repeat

textcolor (Choice);

VerfiyInt(mX + 18, mY + 5, check);

textcolor (Neg);

gotoxy(mX, mY + 1);

Write('| Amount Option Out Of Range |');

Until( check IN [0..10] );//end repeat loop

Initialise;

//Interpret Data And Write To File The Information Processed

If(check <> 0) Then

Begin

With Person[0] Do

Begin

//Get Amount Paid

If( (check MOD 2) = 0) Then AmtPd:= icost[check]

Else AmtPd:= fcost[check];

//Determine Section

If( (check MOD 2) = 1) Then check:= check + 1;

Sections:= check DIV 2;

End;//end with statement

//Confirm Space Available In Section

Reset(Datafile);

max:= 0;

Error:= 0;

Person[1].ID:= -1;

while( EOF(Datafile) = false) Do

Page 56: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

55 | P a g e

Begin

//Person[0].ID:= Person[0].ID + 1;

Read(Datafile, Person[1]);

if(Person[1].Sections = Person[0].Sections) Then max:= max + 1;

End;//end while

Close(Datafile);

Person[0].ID:=Person[1].ID + 1;

if( (max >= PLimit) AND (Null = 1) ) Then Error:= 1;

With Person[0] Do

Begin

//Display Information Entered To Confirm

gotoxy(mX, mY);

Write(' Name - ', First);

gotoxy(mX, mY + 1);

Write(' Surname - ', Surname);

gotoxy(mX, mY + 2);

Write('Amount Paid - $', Currency, ' ', AmtPd:Dcostlength:Ccostlength);

gotoxy(mX, mY + 4);

Write(' Section - ', Sections, ' = ',SecName[Sections]);

if(Error = 0) Then

Begin

gotoxy(mX, mY + 6);

Writeln(' Confirm - ');

gotoxy(mX, mY + 8);

Writeln(' 0 - No... Re-Enter Data');

gotoxy(mX, mY + 10);

Writeln(' 1 - Yes.. Save Data');

textcolor (Choice);

Repeat VerfiyInt(mX + 14, mY + 6, check);

Until( (check = 0) OR (check = 1) );//end repeat loop

if(check = 1) Then

Page 57: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

56 | P a g e

Begin

//For Writing Data Into Datafile

Reset(Datafile);

Seek(Datafile, ID);

Write(Datafile, Person[0]);

Close(Datafile);

SelectProgram:= 0;

End

Else SelectProgram:= 1;

End

Else Begin

textcolor (Neg);

gotoxy(mX + 10, mY + 6);

Write(' Section ',Sections,' Is Full !');

gotoxy(mX + 5, mY + 7);

Write(' Information Can Not Be Stored');

gotoxy(mX - 2, mY + 9);

textcolor (LText);

Write(' Press Any Key To Return To Main Menu');

Readkey;

SelectProgram:=0;

End;//end if statement

End;//end with statement

End

Else SelectProgram:= 0;//end if..else statement

End;//End Procedure Registery

(*--------------------------------------------------------------------------*)

Procedure ListSecName;//Displays Persons @ Section

Const

PrintLimit = 10; //Amount Of Information To Output Each Time

Use = 1;

Page 58: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

57 | P a g e

Var

max, Number, Print, xx:integer;

Person:array[0..Use] of PersonType;

i:array[1..SLimit] of integer;

Begin

Initialise;

Repeat

Initialise;

//Selection Menu Displayed To User

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| View Masqueraders @ Section - |');

For Number:=1 to SLimit Do

Begin

gotoxy(mX, mY + 2 + Number);

Write('| ',Number,' - ',SecName[Number]:12,' = Section ', Number,' |');

End;//end for Loop

gotoxy(mX, mY + 3 + Number);

Write('| 6 - View All Masqueraders |');

gotoxy(mX, mY + 5 + Number);

Write('-------------------------------------');

//Get Valid Input From User

xx:=33;

Repeat

textcolor (Choice);

VerfiyInt(mX + xx, mY + 1, check);

Page 59: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

58 | P a g e

textcolor (Neg);

gotoxy(mX, mY + 1);

Write('| Invalid Option Number - |');

xx:=26;

Until( check IN [1..6] );//end repeat loop

TableHeader;

//Search Files

reset(Datafile);

//Checks To See If Persons Are Registered

For Number:=1 to SLimit Do i[Number]:=0;

max:=0;

Print:=0;

With Person[0] Do

Begin

While( EOF(Datafile) = false )Do

Begin

Read(Datafile, Person[0]);

If( (Sections = check) OR (check = 6) ) Then

Begin

Case Sections of

1: textcolor (Earth);

2: textcolor (Volcano);

3: textcolor (Ice);

4: textcolor (Tornado);

5: textcolor (Lightning);

End;//end case statement

If(Null = 1) Then

Begin

If( (max < PLimit) AND (i[Sections] < PLimit) ) Then

Begin

If(check = 6) Then gotoxy(mX - 12, mY + 5 + Print)

Else gotoxy(mX + 2, mY + 5 + Print);

Page 60: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

59 | P a g e

Write(First);

If(check = 6) Then gotoxy(mX + 12, mY + 5 + Print)

Else gotoxy(mX + 22, mY + 5 + Print);

Write(Surname);

If(check = 6) Then

Begin

gotoxy(mX + 32, mY + 5 + Print);

Write(Sections, ' - ', SecName[Sections]);

i[Sections]:= i[Sections] + 1;

End;

End;//end if statement

End

Else Begin

If(check = 6) Then gotoxy(mX - 6, mY + 5 + Print)

Else gotoxy(mX + 2, mY + 5 + Print);

Write(First);

If(check = 6) Then gotoxy(mX + 15, mY + 5 + Print)

Else gotoxy(mX + 22, mY + 5 + Print);

Write(Surname);

If(check = 6) Then

Begin

gotoxy(mX + 37, mY + 5 + Print);

Write(Sections, ' - ', SecName[Sections]);

i[Sections]:= i[Sections] + 1;

End;//end if..else statement

End;//end if..else statement

max:= max + 1;

Print:= Print + 1;

End;//end if statement

If( ( EOF(Datafile) = false ) AND (Print = PrintLimit) ) Then

Begin

textcolor (LText);

if(check <> 6) Then

Page 61: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

60 | P a g e

Begin

gotoxy(mX, mY + 6 + Print);

Write('-------------------------------------');

End

Else Begin

gotoxy(mX - 15, mY + 6 + Print);

Write('-----------------------------------------------------------------');

End;//end if..else statement

gotoxy(mX - 12, mY + 8 + Print);

Write('Screen Limit Exceeded..Press Any Key To Continue Displaying ');

Readkey;

TableHeader;

Print:= 0;

End;//end if statement

End;//end while loop

End;//end with

close(Datafile);

//If No Person Registered

if( max = 0) Then

Begin

gotoxy(mX + 6, mY + 5 + Print);

Write('No One Has Been Registered');

gotoxy(mX + 6, mY + 6 + Print);

if( check <> 6 ) Then

Begin

Write('To Play In This Section');

Print:= Print + 1;

End;//end if statement

max:= max + 2;

End

Else Print:= Print - 1;//end if..else statement

if(check <> 6) Then

Page 62: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

61 | P a g e

Begin

gotoxy(mX, mY + 7 + Print);

Write('-------------------------------------');

End

Else Begin

textcolor (LText);

gotoxy(mX - 15, mY + 7 + Print);

Write('-----------------------------------------------------------------');

End;//end if..else statement

//Get Valid Input From User

textcolor (LText);

If(check = 6) Then Print:= Print - 1;

gotoxy(mX, mY + 12 + Print);

Write('0 - View Masqueraders @ Section');

gotoxy(mX, mY + 13 + Print);

Write('1 - Return To Main Menu');

gotoxy(mX, mY + 10 + Print);

Write('Enter Option Number - ');

textcolor (Choice);

Repeat VerfiyInt(mX + 22, mY + 10 + Print, check); Until( (check = 0) OR (check = 1) );//end repeat

loop

Until(check = 1);// end repeat loop

SelectProgram:= 0;

End;//End Procedure ListSecName

(*--------------------------------------------------------------------------*)

Procedure ListSecAmt;// Displays Summary @ Section

Const Use = 1;

Var

Number:integer;

i:array[1..SLimit] of integer;

TotalAmount:array[1..SLimit] of real;

Page 63: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

62 | P a g e

Person:array[0..Use] of PersonType;

Begin

Initialise;

For Number:=1 to SLimit Do

Begin

TotalAmount[Number]:= 0;

i[Number]:= 0;

End;

TableHeader;

//Search File To Sort Persons Into Their Sections

reset(Datafile);

While( EOF(Datafile) = false) Do

Begin

Read(Datafile, Person[0]);

With Person[0] Do

Begin

If(Null = 1) Then

Begin

If(i[Sections] < PLimit)Then

Begin

//Total Persons Registered

i[Sections]:= i[Sections] + 1;

//Total The Amount For Each Section

TotalAmount[Sections]:= TotalAmount[Sections] + AmtPd;

End;

End

Else Begin

//Total Persons Registered

i[Sections]:= i[Sections] + 1;

Page 64: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

63 | P a g e

//Total The Amount For Each Section

TotalAmount[Sections]:= TotalAmount[Sections] + AmtPd;

End;//end if..else statement

End;//end with statement

End;//end while loop

close(Datafile);

//Display Info

For Number:= 1 to SLimit Do

Begin

Gotoxy(mX - 8, mY + 3 + Number);

Case Number of

1: textcolor (Earth);

2: textcolor (Volcano);

3: textcolor (Ice);

4: textcolor (Tornado);

5: textcolor (Lightning);

End;

Write( '| ', Number, ' - ', SecName[Number] );

gotoxy( mX + 16, mY + 3 + Number);

Write( i[Number]:3 );

gotoxy( mX + 28, mY + 3 + Number);

Write( '$', Currency, ' ', TotalAmount[Number]:Dcostlength:Ccostlength, ' |');

End;//end for loop

textcolor (LText);

gotoxy(mX - 8, mY + 5 + Number);

Write('----------------------------------------------------');

gotoxy(mX, mY + 7 + Number);

Write('Press Any Key To Return To Main Menu ');

Readkey;

SelectProgram:= 0;

End;//End Procedure ListSecAmt

(*--------------------------------------------------------------------------*)

Page 65: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

64 | P a g e

Procedure DeleteFile;//Deleting Of Storage Files

Type pfiles = file of Profile;

Var

max, Number:integer;

pfile:pfiles;

Begin

check:= -1;

textcolor (LText);

TableHeader;

gotoxy(mX, mY + 4);

Write('| Enter Option Number - |');

gotoxy(mX, mY + 6);

Write('| 1 - Delete All Users |');

gotoxy(mX, mY + 8);

Write('| 2 - Delete All Masqueraders |');

gotoxy(mX, mY + 10);

Write('-------------------------------------');

//Get Valid Input From User

textcolor (choice);

Repeat VerfiyInt(mX + 27, mY + 4, check);

Until( (check = 1) OR (check = 2) );//end repeat loop

max:=check;

textcolor (Neg);

TableHeader;

gotoxy(mX, mY + 4);

Page 66: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

65 | P a g e

If(check = 1) Then Write('| ALL USERS WILL BE DELETED |')

Else Write('| ALL RECORDS WILL BE DELETED |');

gotoxy(mX, mY + 6);

Write('| CONFIRM : ARE YOU SURE ? - |');

gotoxy(mX, mY + 8);

Write('| 0 - NO |');

gotoxy(mX, mY + 9);

Write('| 1 - YES |');

gotoxy(mX, mY + 11);

Write('-------------------------------------');

//Get Valid Input From User

textcolor (choice);

Repeat VerfiyInt(mX + 30, mY + 6, check);

Until( (check = 0) OR (check = 1) );//end repeat loop

Number:=check;

check:=max;

TableHeader;

check:=Number;

textcolor (Pos);

If(check = 0) Then

Begin

gotoxy(mX, mY + 4);

Write('| DELETE CANCELLED |');

End

Else Begin

gotoxy(mX, mY + 4);

Write('| DELETE CONFIRMED |');

Page 67: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

66 | P a g e

//Clear The File

If(max = 1) Then

Begin

Assign(pfile, 'Profiles.fung');

Rewrite(pfile);

Close(pfile);

End

Else Begin

Rewrite(Datafile);

Close(Datafile);

End;//end if..else statment

End;//end if..else statement

textcolor (LText);

gotoxy(mX, mY + 8);

Write('-------------------------------------');

gotoxy(mX, mY + 6);

Write('Press Any Key To Return To Main Menu');

Readkey;

If( (max = 1) AND (check = 1) ) Then Login;

SelectProgram:= 0;

End;//End Procedure DeleteFile

(*--------------------------------------------------------------------------*)

Procedure Quit;//Exiting Screen

Begin

Initialise;

Clrscr;

//Closing Screen

gotoxy(mX, mY);

Write('-------------------------------------');

textcolor (Neg);

gotoxy(mX, mY + 2);

Write('| PRORGRAM SHUTTING DOWN |');

Page 68: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

67 | P a g e

textcolor (Brand);

gotoxy(mX, mY + 5);

Write('| TRINI REVELERS 2015 |');

textcolor (Author);

gotoxy(mX, mY + 8);

Write('| POWERED BY DARREN FUNG |');

textcolor (LText);

gotoxy(mX, mY + 10);

Write('-------------------------------------');

Delay(2500);

Halt;

End;//End Procedure Quit

(*--------------------------------------------------------------------------*)

Procedure Main; //Homescreen

Begin

Initialise;

//Displays Availabe Options

gotoxy(mX, mY);

Write('-------------------------------------');

gotoxy(mX, mY + 1);

Write('| Enter Option Number - |');

gotoxy(mX, mY + 3);

If(User.Priority IN [0,1]) Then Write('| 1 - Register New Masquerader |');

gotoxy(mX, mY + 4);

Write('| 2 - View Masqueraders @ Section |');

Page 69: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

68 | P a g e

gotoxy(mX, mY + 5);

Write('| 3 - View Total Amount @ Section |');

gotoxy(mX, mY + 6);

If(User.Priority = 0) Then Write('| 4 - Modify Storage File |');

gotoxy(mX, mY + 7);

Write('| 5 - Quit Program |');

gotoxy(mX, mY + 9);

Write('-------------------------------------');

//Gets Valid Input From User

Repeat

textcolor (Choice);

VerfiyInt(mX + 26, mY + 1, SelectProgram);

textcolor (Neg);

gotoxy(mX, mY + 1);

If( (User.Priority = 1) AND (SelectProgram IN [4]) ) Then SelectProgram:=0

Else If( (User.Priority = 2) AND (SelectProgram IN [1,4]) ) Then SelectProgram:=0;

Write('| Invalid Option Number - |');

Until( SelectProgram IN [1..5] );//end repeat loop

//Run Appropiate Procedure

Repeat

Case SelectProgram of

0: Main;

1: Registery;

2: ListSecName;

3: ListSecAmt;

4: DeleteFile;

End;//end case statement

Until(SelectProgram = 5);//end repeat loop

End;//End Procedure Main

Page 70: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

69 | P a g e

(*--------------------------------------------------------------------------*)

Procedure Boot; //Loading Screen

Var i:integer;

Begin

//Define All Sections

SecName[1]:= 'Earth';

SecName[2]:= 'Volcano';

SecName[3]:= 'Ice';

SecName[4]:= 'Tornado';

SecName[5]:= 'Lightning';

(*

Prices For Each Section

Prefix Of The Word 'cost':

First Letter: i - Installments

f - Full

*)

//Earth Section

fcost[1]:= 936.00;

icost[2]:= 1196.00;

//Volcano Section

fcost[3]:= 1326.00;

icost[4]:= 1586.00;

//Ice Section

fcost[5]:= 1716.00;

icost[6]:= 1976.00;

//Tornado Section

Page 71: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

70 | P a g e

fcost[7]:= 2171.00;

icost[8]:= 2431.00;

//Lightning Section

fcost[9]:= 2658.50;

icost[10]:= 2918.50;

Clrscr;

//Write My Name

textcolor (Author);

Authoring;

gotoxy(1, 1);

Delay(1000);

textcolor (LText);

//Check to See If File Exists

Writeln(' Searching For Storage File');

assign(Datafile,'Datafile.fung');

{$I-} // Error Checking Disabled

reset(Datafile);

{$I+} // Error Checking Enabled

Delay(1000);

If( IOResult <> 0) Then

Begin

textcolor (Neg);

Authoring;

gotoxy( mX - 12, mY + 12);

Writeln('"Datafile.fung" File Is Mssing ! ... New File Will Be Created');

rewrite(Datafile);

End

Else Begin

textcolor (Pos);

Authoring;

gotoxy(mX + 6, mY + 12);

Writeln('"Datafile.fung" File Is Found');

Page 72: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

71 | P a g e

End;//end if..else statement

close(Datafile);

textcolor (Neg);

Writeln;

If(Null = 1)Then

Begin

Writeln(' NOTE : A Maximum Of ',PLimit,' Persons Per Section Can Be Recorded ! ');

Writeln;

End;//end if statement

textcolor (LText);

Writeln(' Enter Option Number');

Writeln;

Writeln(' Sign In - 1 Register - 2 Guest - 3 Exit - 0');

Repeat

val(Readkey, check, i);

If( i <> 0) Then check:= -1;

Until (check IN [0..3]);//end repeat loop

User.Priority:=2;

If(check IN [1,2]) Then Login

Else If(check = 3) Then Main

Else Quit;

End;//End Procedure Boot

(*--------------------------------------------------------------------------*)

//Main Program

Begin

Initialise;

Boot;

Quit;

End.

Page 73: IT SBA PROJECT 2015 - iLoveLessons...Must Utilize Management And Organizational Skills In Order To Stage A Successful Event. The Program Makes The Work Of The Organiser More Simple

72 | P a g e

9. BASIC FLOW STRUCTURE OF THE PROGRAM

Here Is A Simple Representation Of How The Program Operates. Note, Three Procedures (VerifyInt,

Initialise) Are Not Included. If They Were Placed Into The Flow Structure, Arrows Would Have Been

Clustered And Overlapping Fields. Also, All Subprograms Call The Initialise And VerifyInt Modules.

MAIN

LISTSECNAME LISTSECAMT DELETEFILE

BOOT

LOGIN