it418 - c# programming project: lottery number generator

68
2012 IT418 – C# Programming Project INFORMATICS COMPUTER SCHOOL DIT PROJECT (IT418 – C# PROGRAMMING) < Philippine Charity Sweepstakes Office Lottery Digits Generator > Name/s: Lim, Ma. Carmen N. Address: 37 Padua St. BFRV LPC, M.M. Student No.: 0000 - 7999 Lecturer: Sir Rudrian Riener Pariñas Center: 0535 Country: Republic of the Philippines 0535 - 0000 – 7999 (I-DIT) 1

Upload: carmenlim07

Post on 18-Apr-2015

1.131 views

Category:

Documents


1 download

DESCRIPTION

A documentation about a program made in CSharp that draws winning lottery combinations from Grand Lotto to Ez2.

TRANSCRIPT

Page 1: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

INFORMATICS COMPUTER SCHOOL

DIT PROJECT

(IT418 – C# PROGRAMMING)

< Philippine Charity Sweepstakes Office Lottery Digits Generator >

Name/s: Lim, Ma. Carmen N.

Address: 37 Padua St. BFRV LPC, M.M.

Student No.: 0000 - 7999

Lecturer: Sir Rudrian Riener Pariñas

Center: 0535

Country: Republic of the Philippines

0535

- 00

00 –

799

9 (I-

DIT

)

1

Page 2: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

TABLE OF CONTENTS

I. Description and details of game to be simulated

II. Specification

II.2 Input Specification

II.3 Screen Design

II.4 Program Design

II.5 Validation and processing

III. Program Listing

IV. Testing

4.1 Test Plan

4.2 Test Cases

4.3 Test Log

4.4 Screen Dumps

V. Implementation

5.1 User Manual

VI. Conclusion

6.1 Strengths

6.2 Weaknesses

6.3 Enhancements

VII. Critical Appraisal

ACKNOWLEDGEMENTS

p.3

p.4

p.5

p.6

p.7

pp.8 - 11

p.12

pp.29 - 30

pp.31 - 37

p.28

pp.13 - 27

p.38

p.39

p.39

p.41

p.40

0535

- 00

00 –

799

9 (I-

DIT

)

2

Page 3: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER I: DESCRIPTION AND DETAILS OF GAME TO BE SIMULATED

A Lottery Digit Generator Machine for Philippine Charity Sweepstakes

office is the motif of this documentation. Practically, the machine is going to be used

to randomly select winning lottery digit combinations in general for all categories of

the said game. It is going to be digitally composed following the concepts of visual C#

language.

Now, C# is another variant of an Object Oriented Programming

language developed by Microsoft which combines C++ principles into the rich

environment of Visual basic that supports ‘windows-application-tools’.

The computer language is basically kept simple yet can perform as

much tasks as other programming platforms. It was actually designed to be

comprehensible to developers as it still follows through C language concepts.

What sets C# language apart among other programming format is

that, it works with the .NET Framework which provides a comprehensive and

consistent programming model for building applications that have visually stunning

user experiences and at the same time enforces “Simple Object Access Protocol”

(SOAP) which doesn’t require developers to put additional codes for repeating a

behavior in a program.

Thus, C# language is deemed appropriate to design and craft our

PCSO Lottery Digit Generator because of its convenient encryption of syntaxes that

works well with streamlined visuals which make it light to operate.

0535

- 00

00 –

799

9 (I-

DIT

)

3

Page 4: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER II: SPECIFICATION

3.1 Input Specification

These are the data to be entered to run the lottery digit generator, where in, there is

only one text input on the number of draws then most of them are buttons.

Lottery Digits Generator (frmLotto)Input Variable Text Description

Data Type

Size

textBox21 textBox21This is used to enter a draw

number that counts a session.

String

pbNextDraw NextDraw >

This button should be pressed one at a time per draw attempt in a game session.

n/aW , H

(121 , 30)

pbSort Sort Numbers

This button should only be pressed after a singular attempt on drawing winning lotto numbers.

n/aW , H

(92 , 28)

btnStore Store Digits

This button is pressed last after drawing and sorting

the winning lotto numbers as it saves those as used in

DB.mdb.

n/aW , H

(92 , 27)

pbEnd2 ENDThis button can be pressed

whenever the user feels like closing the application.

n/aW , H

(121 , 30)

toolStripMenuItem1 File

This button is only necessary if a user wants to view

technical details about the game system and exit the

program.

n/aW , H

(121 , 30)

miAbout About

This command is pressed if the user was curious about technical detail of the game

system.

n/aW , H

(121, 30)

miExit Exit Press this command to exit. n/aW , H

(121, 30)

mibtnHelp Help

This command is pressed to direct the user on how to

use the controls of the PCSO ottery digits generator.

n/aW , H

(121, 30)

About (frmAbout)

btClose ClosePressed whenever the user

feels like leaving that message box.

n/aW , H

(121, 30)

Help (form1)

button1 OKPressed whenever the user feels like leaving the help

screen.n/a

W , H(121, 30)

0535

- 00

00 –

799

9 (I-

DIT

)

4

Page 5: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

3.2 Screen Design

frmLotto.cs

Form1.cs (Help) frmAbout.cs

pictureBox1

PCSO.jpg

File Help menuStrip1

AboutExit

PCSO Lottery Draw label2

Winning lotto numbers for:

DD MM YY labelDayTime

textBox21label3 Draw No:

May the luckiest one win!! Label5

1 Label6 6 Digit:

Label7 5 Digit:

Label8 4 Digit:

Label9 3 Digit:

2 3\ 4 5 6

11 10 9 8 7

15 14 13 12

18 17 16

Label10 EZ2:20 19

SORTED!! labelSort

Next Draw >pnNextDraw

pbSort

btnStore

pbEnd2TextBox

groupBox1

Panel3

Panel2Panel1

pictureBox1

btnClose

Label1

Label3

Button1

richTextBox1

Label1HOW TO:

0535

- 00

00 –

799

9 (I-

DIT

)

5

Page 6: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

3.3 Program Design

3.3.a Program Flow Chart

START

Other Buttons pressed?

What Button pressed

Next Draw Button Pressed

Sort Button Pressed

Store Button Pressed

Exit Button Pressed

Other Buttons

pressed?

Label4.Text will count the number of draw attempt.

textBox1 to textBox20 shall randomly pick digits according to a type of lottery game.

Label4.text = draw attempt no. then GrandLotto, 5D, 4D, 3D, EZ2 digits displayed in textBox1 to textBox20 sporadically.

TERMINATE

Sorts all numbers drawn in textBox1.Text to textBox2.Text in ascending order.

A

File Button

Help Button

About or exit button?

All drawn numbers in textbox1 to textBox20 is sorted!

labelSort .text = Sorted!!

B

B

MS Jet will append all lottery data items into DB.mdb

About Buttonpressed

End Button Pressed

The freshly drawn digits are written in DB.mdb as USED numbers.

frmAbout frm = new frmAbout(); frm.ShowDialog();

Form1.cs pops up

Close Button Pressed

A

frmAbout frm = new frmAbout(); frm.ShowDialog();

frmAbout Appears

C

C

Enter a Draw No 1st

0535

- 00

00 –

799

9 (I-

DIT

)

6

Page 7: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

3.4 Validation and processing

A Validation Check will be conducted in this section of the PCSO Lottery

Digits generator to keep inputs specific and ensure that these inputs are executing

the correct process.

Check No.

Data Name Input Type Uniqueness Length Range Process

1 textBox21 Draw Num

A draw number counts a session and should only

accept integers 1 <= 365

The numbers are entered manually here which cannot be null

and are subject to change every draw.

Only three numbers are allowed to be entered into

the draw Number textbox.

Limited to three digits

only as in ### upto 365 as to

a year

Gets draw number data then stores it in a database

when store digits button is clicked.

2 pbNextDraw Next Draw

Lottery Numbers are going to be

randomly generated On

Click!

This button is responsible for

drawing winning lottery numbers per session.

N/A N/A

Initiates the Random Number

selector from 1 to 66.

3 pbSort Sort Numbers

Lottery Numbers will be sorted in ascending order

once clicked.

This button is pressed after drawing the lottery numbers.

N/A N/A

Sorts lottery digits in

ascending order.

4 btnStore Store Digits

Lottery Numbers will be saved in an external database to be rendered as

used.

This button is pressed after drawing and sorting the lottery

numbers.

N/A N/A

Stores lottery data into an external db

file via OLEDB

5toolStripMenuI

tem1File

This option in the menu strip will drop

down about and exit submenu.

Pressed whenever the user feels like it.

N/A N/A

Menu bar item that contains

about and exit sub menus.

6 miAbout About

This option will show the user some technical

information about the lottery machine.

Pressed whenever the user feels like it.

N/A N/A

Menu bar sub item that

contains details about

the lottery machine.

7 mibtnHelp Help

This option will open a short

manual for the user if they’re clueless with the Lottery

program.

Pressed whenever the user feels like it.

N/A N/A

Menu bar sub item that

shows a manual to the user for the

lottery machine.

8 btClose CloseWill close the

About screen On Click!!

Pressed whenever the user feels like it.

N/A N/ACloses about modal dialog.

9 Button1 OKWill close the Help screen On Click!!

Pressed whenever the user feels like it.

N/A N/ACloses help

modal dialog.

10 pbEnd2 ENDWill Exit the entire program On Click!

Pressed whenever the user feels like it.

N/A N/ACloses the

whole program.

0535

- 00

00 –

799

9 (I-

DIT

)

7

Page 8: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER III: Program Listing

This is a preview of Visual C# Codes used to construct the PCSO Lottery Digits

Generator Machine complete with line numbers.

0535

- 00

00 –

799

9 (I-

DIT

)

8

Page 9: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

0535

- 00

00 –

799

9 (I-

DIT

)

9

Page 10: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

0535

- 00

00 –

799

9 (I-

DIT

)

10

Page 11: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

//lines 185 to 205

private void btnStore_Click(object sender, EventArgs e)

{

objConnection = new OleDbConnection(strConnection);

objConnection.ConnectionString = strConnection;

objConnection.Open();

//the SQL query code stretches all the way straight to the right in the actual code view in the editor.

strSQL = "INSERT INTO UsedNums (NumID, GrandLotto1 , GrandLotto2 , GrandLotto3 , GrandLotto4 , GrandLotto5 , GrandLotto6 , 5D1 , 5D2 , 5D3, 5D4, 5D5, 4D1 , 4D2, 4D3 , 4D4 , 3D1 , 3D2 , 3D3 , EZLotto1 , EZLotto2 ) " + "VALUES ( '" + label21.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox14.Text + "','" + textBox15.Text + "','" + textBox16.Text + "','" + textBox17.Text + "','" + textBox18.Text + "','" + textBox19.Text + "','" + textBox20.Text + "')";

objCmd = new OleDbCommand(strSQL, objConnection);

objCmd.ExecuteNonQuery();

MessageBox.Show("the DIGITS has been stored into a database located at the 'bin' project folder of this machine to be marked as USED!!");

}

private void pbEnd2_Click(object sender, EventArgs e)

{

Console.Beep();

Application.Exit();

}

}

}

0535

- 00

00 –

799

9 (I-

DIT

)

11

Page 12: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER IV: TESTING

4.1 Test Plan

The PCSO Lottery Digits Generator, of which is essential for drawing

winning numbers for that sort of game, has already completed the development

phase by now. To ensure the quality of this gaming system, a series of test cases

should be done to see if there are any underlying defects to correct in the program.

The machine will be manually tested based on its Physical and Logical

Aspects. Where in, the essential statements and syntaxes will be the data to be

evaluated in this phase.

Basically, there are measures to be observed and they are objectives

that this testing should achieve and are listed below as follows:

To ensure that all the objects in the program are functional.

To see if statements and syntaxes in the program are in accord and

execute commands systematically.

To make sure that the program runs without any errors.

Therefore, it is necessary for the PCSO Lottery Digits Generator to undergo testing

so there will be guarantee that it will run flawlessly. This procedure also helps the

developers to detect errors that have been over looked during the creation stage.

The testing process shall now commence turning on the next page.

0535

- 00

00 –

799

9 (I-

DIT

)

12

Page 13: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

4.2 Test Cases

Test Case No. 01

Objective

Checking if the about option within the file menu opens a

window that displays technical details for the PCSO lottery

digits generator.

Test Data

frmAbout frm = new frmAbout();frm.ShowDialog();

Expected Test Result

When the about option is selected from the file menu its

code should execute and display a window that contains

technical details about the PCSO Lottery Digits Generator.

Actual Result

Conclusion No sign of any errors.

0535

- 00

00 –

799

9 (I-

DIT

)

13

Page 14: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 02

Objective To see if the code for opening the Help window works.

Test Data

frmHelp frm = new frmHelp();frm.ShowDialog();

Expected Test Result

The code should enable the help command in the menu strip

open a help window when clicked.

Actual Result

Conclusion No Visible Errors.

0535

- 00

00 –

799

9 (I-

DIT

)

14

Page 15: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 03

Objective

To test whether the syntax for returning the current date and

time necessary to chronicle the number draws in the lottery

digit generator works.

Test DataDateTime dt = new DateTime();dt = DateTime.Now;DateTime dt1 = DateTime.Today; this.labelDaytime.Text = dt1.ToLongDateString();

Expected Test Result

The label for the date and time of the Lottery Digits

Generator should update to the present day.

Actual Result

Conclusion The data is Error-Free.

0535

- 00

00 –

799

9 (I-

DIT

)

15

Page 16: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 04

Objective

Checking if the textbox for entering a draw number to count a

single lottery machine session accepts data then writes it in

the UsedNums table of an MS Access Database .

Test Data

Expected Test Result

The number of draw attempts should be entered into its

designated textbox and count a lottery digits generator

session or draw attempt and record that in a database.

Actual Result

Conclusion No errors visible.05

35 -

0000

– 7

999

(I-D

IT)

16

Page 17: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 05

Objective

Seeing if the ‘Next Draw’ button actually selects random

numbers in the twenty textboxes and counts the number of

draws made.

Test Data

Expected Test Result

The Next Draw button should randomly load numbers in the

textboxes and count the number of draws at the same time.

Actual Result

Conclusion No Existing Errors.05

35 -

0000

– 7

999

(I-D

IT)

17

Page 18: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 06

Objective

To see whether sort numbers button rearranges the numbers

in the twenty text boxes into ascending order.

Test Data

Expected Test Result

Once the sort numbers button is pressed it should rearrange

the winning numbers shown in the twenty text boxes into

ascending order.

Actual Result

Conclusion No Errors Detected.

0535

- 00

00 –

799

9 (I-

DIT

)

18

Page 19: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 07

Objective

To check if the store digits button actually saves the winning

number combination data into a database once clicked.

Test Data

Expected Test Result

When the store digits button is pressed it should save

winning number combination data into a database once

clicked. A Message box should prompt to indicate to the user

that data has been written into a data base to mark as used.

Actual Result

Conclusion No Existing Errors.05

35 -

0000

– 7

999

(I-D

IT)

19

Page 20: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 08

Objective To see if the END button exits the application altogether.

Test Data

Console.Beep();Application.Exit();

Expected Test Result

The end button should terminate the whole Lottery Digit

Generating system once clicked.

Actual Result The application closed in a beep.

Conclusion Runs successfully without errors.

0535

- 00

00 –

799

9 (I-

DIT

)

20

Page 21: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 09

Objective

Seeing if the exit command in the File Menu terminates the

lottery digit program once clicked.

Test Data

Console.Beep();Application.Exit();

Expected Test Result

The exit command should terminate the whole Lottery Digit

Generating system once clicked.

Actual Result The application closed in a beep.

Conclusion No errors detected.05

35 -

0000

– 7

999

(I-D

IT)

21

Page 22: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 10

Objective

Checking if the OK button of the help window confirms and

leaves that screen.

Test Data

Close();

Expected Test Result

When the OK button is clicked it should confirm and leave

the help window.

Actual Result The OK button works as expected.

Conclusion No Errors Found.

0535

- 00

00 –

799

9 (I-

DIT

)

22

Page 23: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 11

Objective

To test whether the close button of the about form leaves its

window back to the lottery digits generator interface.

Test Data this.Close()

Expected Test Result

When the close button of the about form is clicked it leaves

the screen back to the lottery digits generator interface.

Actual Result The close button works as expected.

Conclusion No visible errors.

0535

- 00

00 –

799

9 (I-

DIT

)

23

Page 24: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No.

12

Objective

Checking if the Ole Db connection actually communicates with an MS

Access Database through its data source.

Test Data

strConnection ="Provider=Microsoft.Jet.OleDb.4.0; data source=..\\DB.mdb;";objConnection = new OleDbConnection(strConnection);objConnection.ConnectionString = strConnection;objConnection.Open(); strSQL = "INSERT INTO UsedNums (NumID, GrandLotto1 , GrandLotto2 , GrandLotto3 , GrandLotto4 , GrandLotto5 , GrandLotto6 , 5D1 , 5D2 , 5D3, 5D4, 5D5, 4D1 , 4D2, 4D3 , 4D4 , 3D1 , 3D2 , 3D3 , EZLotto1 , EZLotto2 ) " + "VALUES ( '" + label4.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox14.Text + "','" + textBox15.Text + "','" + textBox16.Text + "','" + textBox17.Text + "','" + textBox18.Text + "','" + textBox19.Text + "','" + textBox20.Text + "')";objCmd = new OleDbCommand(strSQL, objConnection);objCmd.ExecuteNonQuery();

Expected Test Result

The connection is tested through database explorer and should inform

the user that the test connection succeeds.

Actual Data

Conclusion No errors detected.

0535

- 00

00 –

799

9 (I-

DIT

)

24

Page 25: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No.

13

Objective

To test if SQL statement in the Lottery Digits Generator actually

updates a table in an MS Access Database and is recorded as used.

Test Data

strSQL = "INSERT INTO UsedNums (NumID, GrandLotto1 , GrandLotto2 , GrandLotto3 , GrandLotto4 , GrandLotto5 , GrandLotto6 , 5D1 , 5D2 , 5D3, 5D4, 5D5, 4D1 , 4D2, 4D3 , 4D4 , 3D1 , 3D2 , 3D3 , EZLotto1 , EZLotto2 ) " + "VALUES ( '" + label4.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox14.Text + "','" + textBox15.Text + "','" + textBox16.Text + "','" + textBox17.Text + "','" + textBox18.Text + "','" + textBox19.Text + "','" + textBox20.Text + "')";

Expected Test Result

The SQL statement should insert the winning lottery digits of all game

types into a table in and MS access database.

Actual Result

Conclusion Runs successfully without errors.

0535

- 00

00 –

799

9 (I-

DIT

)

25

Page 26: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 14

Objective

To see if the random number generator is only limited to 66

digits.

Test Data

Random rnd = new Random(dt.Millisecond);for (int i = 1; i < c; i++) { numb[i] = rnd.Next(1, 66); }

Expected Test Result

Winning numbers for the lottery number genny should only

return digits upto 66.

Actual Result All the winning numbers drawn were less than or equal to 50.

Conclusion No visible errors.05

35 -

0000

– 7

999

(I-D

IT)

26

Page 27: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Test Case No. 15

Objective

To check if labelSort.Text shows the word “SORTED!!” to

indicate that the winning numbers are sorted.

Test Datathis.labelSort.Visible = false;this.labelSort.Visible = true;

Expected Test Result

The word SORTED should show up to indicate that the

winning numbers are already sorted in ascending order.

Actual Result

Conclusion The data is absolutely error free.

0535

- 00

00 –

799

9 (I-

DIT

)

27

Page 28: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

4.3 Test Log

PCSO Lottery Digits Generator Test Log

Project: IT418

System: Gaming

Build:C Sharp

Config: N/A

Tool: Visual C# 2008 Express Edition

Event:N/A

Date: 2012.05.26

Time:3:20 -4:30 PM

Tester: Ma. Carmen Lim

Result:No Errors Detected

ResultsTest Script Version Result

Test Case: 1 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 2 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 3 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 4 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 5 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 6 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 7 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 8 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 9 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 10 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 11 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 12 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 13 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 14 Passed: Yes Failed: No Deferred: No Comment: Error-FreeTest Case: 15 Passed: Yes Failed: No Deferred: No Comment: Error-Free

MetricsMetric: LOC 211 Calculation: n/aMetric: LLOC 69 Calculation: n/aSignature: Ma. Carmen N. Lim Date: 2012.05.10

0535

- 00

00 –

799

9 (I-

DIT

)

28

Page 29: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

4.4 Screen Dumps

LOTTO DIGITS GENERATOR FORM

This is the actual

interface of

Lottery Digit

Generator where

lucky draws

actually occur in

quadratic

Textboxes once

the Next Draw

Button is clicked.

Numbers are

then sorted via the Sort ‘Numbers’ button and stored into a database via the ‘Store

Digits button’.

ABOUT WINDOW

This window pops up once the user, click on the File

Menu from the bar on top of the Lottery Digits

Generator Screen. It only shows the technical details

that associates with the game system in terms of the

date of creation, version, the author and licensing.

0535

- 00

00 –

799

9 (I-

DIT

)

29

Page 30: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

STORED ITEMS MESSAGE BOX

This pops up once the user clicked on the “Store Digits” Button on the Lottery Digits

Generator interface to indicate that the winning lottery digits drawn was stored in a

database and is rendered USED.

HELP WINDOW

This window shows up when the help menu is clicked from the bar atop the lottery

digit generator machines interface. It displays context on how to operate the gaming

system.

0535

- 00

00 –

799

9 (I-

DIT

)

30

Page 31: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER V: IMPLEMENTATION

5.1 User Manual

This section of the documentation is compelled to explain to the user the

proper utilization of PCSO Lottery Digits Generator. Again, the purpose of the

machine is to generate winning number combinations for all categories of that game

of luck. Technically, the Lottery system is crafted in C Sharp Programming language

which streamlines items contained in a particular windows form application. This

type of C language can work with robust graphical user interfaces which would need

prerequisites to run. So before we begin with directives on how to operate this lottery

digit generator we should first determine System Requirements for the user to take

note and obtain. The machine is best suited for the later versions of windows which

are XP and 2007 since it is crafted using visual C# 2008 Express Edition.

Software Requirements

Microsoft Visual Studio 2008/ 2010 Express Edition (Freeware)

Hardware Requirements

Central Processing Unit

Hi-Res Monitor

keyboard

Mouse

PowerBox

USB Port/ CD Rom DVD Drive

Windows XP Home/ Professional Windows 7

Minimum Recommended Recommended

Pentium 233-megahertz

(MHz) processor

Pentium 300-megahertz

(MHz) processor

1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64)

processor

64 MB RAM 128 MB RAM 1 gigabyte (GB) RAM (32-bit) or 2 GB RAM (64-bit)

1.5 gigabytes (GB) HDD 1.5 gigabytes (GB) HDD 16 GB hard disk space (32-bit) or 20 GB (64-bit)

Super VGA (800 x 600) Super VGA (800 x 600)DirectX 9 graphics device with WDDM 1.0 or higher

driver 0535

- 00

00 –

799

9 (I-

DIT

)

31

Page 32: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

Once the user has already acquired the system requirements for running this

machine, we can now prepare the Lottery Digits generator for installation for starters.

PCSO Lottery Digits Generator Setup:

There are two means of installing the Lottery Digits generator into the user’s desktop

and that would be either a USB device or CD RW that can be either Manual or

Wizard, read ahead for the procedures.

A. USB device installation:

One way to install the PCSO Lottery Digits Generator Machine is via a USB

device or commonly referred to as the flash drive. Initially the developer will

provide the file you will transfer then just follow these quick steps:

1.) Pull out your USB flash drive wherever and plug it in a USB port the

user’s desktop should

automatically recognize

the device and should

automatically direct a

user to its removable

disk drive. Open that

drive.

NOTE: you can manually locate your USB drive on MY COMPUTER!!

2.) Once the USB removable disk drive is opened you will

immediately see the Lotto Folder in there, copy paste that

into your desktop to transfer it .

0535

- 00

00 –

799

9 (I-

DIT

)

32

Page 33: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

B. CD-RW Installation (Manual) :

This is another method in installing the PCSO Lottery Digits Generator into the user’s

desktop it is also a simple task of transferring a file. The CD RW will be provided by

the developer initially upon request by the way.

1.) Feed the PCSO lottery digits generator CD-RW into the computers CD ROM

drive. Wait for it to load then it will prompt the user to open a folder.

NOTE: The user can manually open the CDROM local drive in MY

COMPUTER too.

2.) Once the CDROM local drive is opened the user will see a zipped Lotto folder

Copy and paste then right click >> extract that into the desktop and taddah!!

The system is transferred.

After the installation we shall proceed to opening then operating the Lottery Machine.

B.1. CD-RW Installation (Wizard):

1.) From the PCSO

Lottery Machine CD-RW,

extract zipped folders

into desktop first then the user will see theses icons on the window. They can

double click any of the two icons to install the application.

2.) Once double clicked an application

warning will show, don’t feel threatened

by that message for that is normal.

Ignore the warning and click install.

0535

- 00

00 –

799

9 (I-

DIT

)

33

Page 34: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

3.) Right when install button

was clicked the Lottery

Machine will be

automatically start and

installed into “windows

program files” and will

show up in the “all

programs” panel when

the user hits the start button.

Opening and Operating the PCSO Lottery Digits Generator Machine:

1.) We have now

transferred the Lotto

folder into the desktop

all we have to do now is

double click it.

2.) Locate the lotto icon that looks like this

in the face of that folder.

0535

- 00

00 –

799

9 (I-

DIT

)

34

Page 35: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

3.) After clicking the ICON the MICROSOFT Visual Studio 2008 Express Edition

Editor will appear from there go to the solution explorer then double click on

frmLotto.cs

Click frmLotto.cs TWICE!!

0535

- 00

00 –

799

9 (I-

DIT

)

35

Page 36: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

4.) The user is

now in the

designer view

of the program

they don’t have

to do anything

but press the

play button.

PAK!!

The Program is

now running, we

shall now control

our PCSO

Lottery Digits

Generator. Its

interface will just

be explained for

this phase.

REQUIRED: Before you can use the controls you should input a draw number into

the textbox provided.

Area where drawn Lottery Numbers will Appear!

0535

- 00

00 –

799

9 (I-

DIT

)

36

Page 37: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

MAIN CONTROLS:

A.) To draw lottery number simply press Next Draw > button it will start selecting

numbers in random according to the lottery game type. Notice the Draw No

label change to indicate the count of attempts.

B.) To sort out the numbers simply click Sort Numbers Button.

C.) Click Store Digits to store winning digit combinations into MS Access

database. A message box will inform the user that the data has been saved

when this is successful.

ADDITIONAL Controls:

END – to close the program.

FILE – to view about dialog box.

HELP- built in tutorial for the lottery machine.

Store Number Button Usage:

Let’s say, the user has

already drawn winning

lottery digits and stored it in a

database using the Store

Digits button in the

machine’s interface.

A Message box that

states the lottery digits are stored into a database

so they will be marked as USED. When this

happens the

user can view

0535

- 00

00 –

799

9 (I-

DIT

)

37

Page 38: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

the numbers stored in a database so they can take note of it. To do that they should

go to the database explorer in the visual studio interface of the lottery solution then

expand the table folder then right click on the UsedNums table and click retrieve

data. The stored digits will be displayed in that tables field right away

0535

- 00

00 –

799

9 (I-

DIT

)

38

Page 39: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER VI: CONCLUSION

6.1 Strengths

The PCSO Lottery Digits Machine is now fully operational and has surpassed

the development and trial stages, as stated earlier, following through the discipline of

C# language.

The gaming system holds to its promise as a mechanically efficient tool than

its predecessor as it can now draw numbers from 1 to 66 accurately in textboxes by

assigning them into an array that is then handled by a random selector.

There is an algorithm at the back end of this lottery system to ensure the

credence of the winning number combinations that were drawn by the machine. After

the numbers have been drawn it can be sorted by a button in a descending order to

keep things organized.

What makes this program all the more special is that it has a storage feature

that writes the winning digits drawn into an MS Access Database for the purpose of

eliminating the numbers that have been used.

Finally, the Lottery Machine has been topped off with a label that shows the

current date and time of a draw to chronicle the session. There is also a label that

counts the number of attempts the lottery machine made a draw. Therefore, the

machine is certified marvelous!

0535

- 00

00 –

799

9 (I-

DIT

)

39

Page 40: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

6.2 Weaknesses

As much as there are a bundle of good points about the PCSO Lottery

Number Generating Machine there are fault areas in it and blame that to the noobie-

ness of the programmer.

Since the developer is only a student in Informatics Filinvest at this time she

still has a lot more to learn about this branch of information technology but the fact

that she was able to add the important details makes her competent. However,

having the lottery numbers stored in an external database for elimination will trouble

the user to view it in a distant folder where in they constantly have to find that source

file. Generated lottery numbers are not automatically removed from the random

selection so the users will need to consciously note down the numbers used from its

inclusive database and remember that.

6.3 Enhancements

The PCSO lottery machine can improve by adding another feature

which allows users to view the USED lottery winning numbers in a table of a

database in a subform within the machine so they won’t have to leave the program to

check what has been appended in there. Lottery digits that have been drawn should

be deleted automatically when it has been generated so the user won’t have to take

note of the numbers manually and avoid drawing digits many times to achieve

desired results.

0535

- 00

00 –

799

9 (I-

DIT

)

40

Page 41: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

CHAPTER VIII: Critical Appraisal

This is where the documentation for PCSO Lottery Generating machine

comes to an end and the developer is asked to write closing remarks and insight

pertaining to the creation of this project.

She would like to impart that it has been enjoyable creating a program in C#

because it is very light and easy to use and much convenient that other C language

formats. It works very well with .NET Framework and employs Simple Object Access

Protocol to keep syntaxes into a minimal. Connecting C# programs into a database is

also very easy accompanied by the database explorer panel as well for supervision.

The developer would like to create more games using the computer

language in the future but unfortunately C# language has been depreciated

according to a mentor and is rarely used these days.

Perhaps the developer can only use C# for recreation and leisure only

unless it becomes a necessity again someday.

0535

- 00

00 –

799

9 (I-

DIT

)

41

Page 42: IT418 - C# Programming Project: Lottery Number Generator

2012

IT418 – C# Programming

Project

ACKNOWLEDGEMENTS

First of all, My special thanks to the almighty God who blessed me with the

capability to complete such tasks, my family and friends who encouraged and

supported me in my education through out.

Extending my credits to the hard work and dedication of the entire

management and staff of Informatics Filinvest Alabang meant for our quality

education.

My utmost gratitude to Sir Rudrian Riener Pariñas for ensuring we learn every

crucial lesson there is regarding C# programming wit respects to game development.

0535

- 00

00 –

799

9 (I-

DIT

)

42