|
Morning Announcements & Pledge
Spring Break Week in
|
|
|
Click for Instructions
Click on the date to open the details.
Click date again to close the details.
|
| Day |
Date |
|
Discussion
|
| 1 |
11/12/07 |
|
Monday - Vocabulary - Technology, Complete "vbSnake" |
|
- Classroom Discussion -
- Lab Assignment -
- Finish up the snake VB game
|
| 2 |
11/13/07 |
|
Tuesday - Science - Hard Discs, "vbPacMan" - Create the Game Board & Place the Blocks & Dots |
|
- Classroom Discussion -
- Science - howStuffWorks.com
- Science - Enjoy a couple of videos about building a computer
- Lab Assignment -
- Create a new VB game "vbPacMan" to play the famous game:
- Create a new VB executable named "vbPacMan"
- Everything will be multiples of 500
- Create the game board:
- The game board will have 11 rows & 11 columns
- Add a shape object named "shpBoard", size it in multiples of 500 (I used width="5500" & height="5500")
- Place the board in multiples of 500 (I used "left=500" & "top=1500")
- Add a shape object named "shpBlock", sized in multiples of 500
- Copy & paste - creating control arrays - for a total of 121
- Bring all blocks to front so they show on top of the board
- Add a shape object named "shpDot", sized 1/3 of 500
- Copy & paste - creating control arrays - for a total of 121
- Bring all dots to front so they show on top of the board and any blocks
- Use a label object to give the player some instructions: "Instructions: Press a number [0 to 9[ to select a game board. Press [G] to start the game. Use the number keypad [2], [4], [6], [8] to control the pacman movement. Avoid the Red ghosts. Catch the Blue ghosts for more points. Eat all the dots for points. Eat the super-sized dots to turn the Red ghosts to Blue ghosts for 30 seconds."
- Code the Form_Load():
- Pseudocode to create a loop to position the blocks & dots in rows & columns of 11 by 11
for 1 to 11 rows
for 1 to 11 columns
i = (row - 1) * 11 + col
set block & dot left, top, width, & height
next column
next row
- Use a keydown sub-routine instead of keypress, in the code, click in the form_load(), change the top right drop-down to keydown
- Pseudocode for "Form_KeyDown()":
select case KeyCode
case vbkeyescape: end ' exit program
case vbkeyup: intManDir = 1 ' up
case vbkeydown: intManDir = 2 ' down
case vbkeyleft: intManDir = 3 ' left
case vbkeyright: intManDir = 4 ' right
case vbKey1: call drawBoard(1) ' draw board # 1
end select
- Create a text file named "board1.txt" with a pattern of "x" & "o" in 11 x 11 rows & columns representing blocks & no blocks
- Open the text file, input each "x" or "o" into a string variable
- For an "x", set the block to visible & the dot to not visible
- For an "o", set the block to not visible & the dot to visible
- Pseudocode for "drawBoard(intFileNum as integer)":
set strFileName to "board" & intFileNum & ".txt"
if the file is not empty
close
open strFileName for input as #1
loop rows for 1 to 11
loop cols for 1 to 11
set i = row - 1 * 11 + col
read 1 string character from the input file
if "x" then block(i) is visible & dot(i) is not visible
if "o" then block(i) is not visible & dot(i) is visible
if " " then block(i) is not visible & dot(i) is not visible
end loop cols
end loop rows
end if
- Test, test, test...
|
| 3 |
11/14/07 |
|
Wednesday - Career - Cover Letters, "vbPacMan" - Create Additional Levels of the Game Board |
|
- Classroom Discussion -
- Career - Cover Letters:
- Lab Assignment -
- Continue with "vbPacMan" - Add additional board levels:
- Create additional text files "board2.txt", "board3.txt", "board4.txt"
- Create patterns of "x" & "o" where "x" means a block is visible & "o" means a dot is visible
- Use a keydown sub-routine instead of keypress, in the code, click in the form_load(), change the top right drop-down to keydown
- Pseudocode for "Form_KeyDown()":
select case KeyCode
case vbkeyescape: end ' exit program
case vbkeyup: intManDir = 1 ' up
case vbkeydown: intManDir = 2 ' down
case vbkeyleft: intManDir = 3 ' left
case vbkeyright: intManDir = 4 ' right
case vbKey1: call drawBoard(1) ' draw board # 1
case vbKey2: call drawBoard(2) ' draw board # 2
case vbKey3: call drawBoard(3) ' draw board # 3
case vbKey4: call drawBoard(4) ' draw board # 4
end select
- Test, test, test...
|
| 4 |
11/15/07 |
|
Thursday - Math - Binary & Hexadecimal, "vbPacMan" - Add the PacMan & Get Him Moving |
|
- Classroom Discussion -
- Ms. Verde will discuss Decimal-Binary-Hexadecimal numbers & conversions
- Next week you will write a VB program to perform the conversions
- Lab Assignment -
- Continue with "vbPacMan" - Move the man:
- Add an image object named "imgMan" sized "width=500" & "height=500" with the image of the pacman
- Add a timer object named "tmrMan" to control how often the pacman moves
- Add a variable named "intManDir" to control which way the pacman moves, initialize "intManDir=0" (not moving) in the form_load
- Pseudocode for "tmrMan":
call canMove(man.top, man.left, intManDir)
select case intManDir
case 0: 'nothin much goin on here, jus kickin back & chillin
case 1: move man up
case 2: move man down
case 3: move man left
case 4: move man right
end select
- Use another sub-routine to decide if the man (or ghost) can move
- Pseudocode for sub-routine "canMove(intTop, intLeft, intDir)":
set i = (intTop - boardTop) / 500 * 11 + intLeft / 500
'WOW, what the heck's goin on here???
'Don't move the man off the board or onto a visible block
'Remember, I have 11 rows of 11 columns, or 11 * 11 = 121
'All my blocks & dots are numbered between 1 & 121
'Before I allow the man to move I have to find out where the man is
'I know the man.Top & the man.Left position (in twips)
'I have to figure out what that means in a number between 1 & 121
'So I set "i" to equal a number between 1 & 121 using left & top
select case intDir
case 1:
if intTop <= board.Top then 'hit top, don't move up any more
intDir = 0
elseif block(i - 11.)Visible then ' hit block, don't move
intDir = 0
end if
case 2:
if intTop + height >= board.Top + board.Height then
intDir = 0 ' hit bottom, don't move
elseif block(i + 11).Visible then ' hit block, don't move
intDir = 0
end if
case 3:
if intLeft <= board.Left then 'hit left, don't move
intDir = 0
elseif block(i - 1).Visible then ' hit block, don't move
intDir = 0
end if
case 4:
if intLeft + width >= board.Left + board.Width then 'hit
intDir = 0
elseif block(i + 1).Visible then ' hit block, don't move
intDir = 0
end if
end select
- Test, test, test...
|
| 5 |
11/16/07 |
|
Friday - SkillsUSA, Quiz, "vbPacMan" - Add the Ghosts & Get Them Moving |
|
- Classroom Discussion -
- Math Quiz on Decimal/Boolean conversion - printed page handout, name & date, fill-in-the-answers, & hand-in NO CALCULATORS
- Visual Basic Quiz 6. Click the link & follow the instructions. You only get one chance - this is not "try until you score 100". Open notes, open internet, open VB IDE (you may try out your answer in a program before you submit it), you may ask me for clarification, you may NOT ask me for the answers, likewise you may NOT ask another student
- Lab Assignment -
- Continue with "vbPacMan" - Move the ghosts:
- Add an image objects named "imgGhost"
- Copy "imgGhost", paste 3 more ghosts, create a control array
- Add a timer object named "tmrGhost", set the interval to 333
- Change the man timer to interval 250 ' faster than the ghosts
- Add a variable "ig" to be the index that determines which ghost out of four
- The ghosts will move similarly to the man, but the computer will choose the direction of movement
- The ghost will always start in the center of the board (121 blocks / 2 = block 61)
- The ghost will always move
- The ghost will stay on the game board
- The ghost will never reverse course (backwards)
- When the ghost hits a wall the ghost will change directions
- Pseudocode for "tmrGhost()":
for ig = 1 To 1 ' get it working with one ghost, then change this to four
select case getNewGhostDir() ' call function to get new direction
case 1: move ghost(ig) up
case 2: move ghost(ig) down
case 3: move ghost(ig) left
case 4: move ghost(ig) right
end select
next ig
- There are 16 rules for ghost change directions:
- Pseudocode for function "getNewGhostDir()":
select case whichWayCanGhostMove()
| case | possible direction | return direction | comments |
| 0: | no move available | 0 | this should never occur |
| 1: | move up only | 1 | can't occur if moving down, will not reverse |
| 2: | move down only | 2 | can't occur if moving up, will not reverse |
| 3: | move up or down | 1 or 2 | randomly choose up or down |
| 4: | move left only | 3 | can't occur if moving right, will not reverse |
| 5: | move up or left | 1 or 3 | randomly choose up or left |
| 6: | move down or left | 2 or 3 | randomly choose down or left |
| 7: | move up or down or left | 1 or 2 or 3 | randomly choose up or down or left |
| 8: | move right only | 4 | can't occur if moving left, will not reverse |
| 9: | move up or right | 1 or 4 | randomly choose up or right |
| 10: | move down or right | 2 or 4 | randomly choose down or right |
| 11: | move up or down or right | 1 or 2 or 4 | randomly choose up or down or right |
| 12: | move left or right | 3 or 4 | randomly choose left or right |
| 13: | move up or left or right | 1 or 3 or 4 | randomly choose up or left or right |
| 14: | move down or left or right | 2 or 3 or 4 | randomly choose down or left or right |
| 15: | move up or down or left or right | 1 or 2 or 3 or 4 | this should never occur |
end select
return getNewGhostDir
- Pseudocode for function "getWhichWayCanGhostMove()"
New variable intGM ' to hold a number between 1 & 15 to show the different possible ghost moves
select case intGhostDir(ig)
case 1: ' currently moving up, can't ever move down
If can move up, add 1 to intGM
If can move left, add 4 to intGM
If can move right, add 8 to intGM
case 2: ' currently moving down, can't ever move up
If can move down, add 2 to intGM
If can move left, add 4 to intGM
If can move right, add 8 to intGM
case 3: ' currently moving left, can't ever move right
If can move up, add 1 to intGM
If can move down, add 2 to intGM
If can move left, add 4 to intGM
case 4: ' currently moving right, can't ever move left
If can move up, add 1 to intGM
If can move down, add 2 to intGM
If can move right, add 8 to intGM
end select
return intGM as getWhichWayCanGhostMove
- Test, test, test...
|
|
| 6 |
11/19/07 |
|
Monday - Math, VB6 Constants, "vbPacMan" - Keep Score & Ghosts Eat Man |
|
- Classroom Discussion -
- Vocabulary - Constant: webopedia.com - a value that never changes
- Math - PacMan math:
- On a game board grid of rows by columns, we can determine which block number we're at by using row number & column number with a formula:
i = (intRow - 1) * intNumOfCols + intCol
'row (number - 1) times number of columns plus column number
- On a game board grid of rows by columns, we can determine which block number we're at by using the top & left position of an object with a formula:
i = (((imgMan.Top - shpBoard.Top) / intSize) * intNumOfCols) + (imgMan.Left / shpBoard.Left)
'(object top - board top) divided by size of object times number of columns plus object left divided by board left
- In order to see if two objects occupy the same space on the board, test to see if their tops & lefts match, sometimes applying an offset:
If imgMan.Top = shpDot(i).Top - 200 And imgMan.Left = shpDot(i).Left - 200 Then
'top = top - offset and left = left - offset
- Lab Assignment -
- Modify "vbPacMan" to use constants:
- Suppose we have a game board that's 11 rows by 11 columns, we could set up constants (similar to variables but they never change) for number of rows & number of cols:
Const intNumOfRows As Integer = 11
Const intNumOfCols As Integer = 11
- We can then replace all of our "11's" with either intNumOfRows or intNumOfCols, following some rules:
- Don't replace the "Const" statement in the "Option Explicit"
- Don't replace any case statements: "Case 11:"
- Replace any "For intRow = 1 to 11" with "intNumOfRows"
- Replace any "For intCol = 1 to 11" with "intNumOfCols"
- Replace any "i - 11" with "i - intNumOfRows"
- Replace any "i + 11" with "i + intNumOfRows"
- Replace any "* 11" with "* intNumOfCols"
- Test, test, test...
- If the size of all our visible objects like man & ghost is 500 & block is 505, we can set additional constants:
Const intSize As Integer = 500
Const intOverSize As Integer = 505
- Then we can replace all "500" & "505":
- Don't replace the "Const" statement in the "Option Explicit"
- Test, test, test...
- Modify "vbPacMan" to keep score:
- Add a label object named "lblScore"
- Add an integer variable named "intScore", initialized to zero (0)
- Pseudocode for pacman eating a visible dot:
' Add to "tmrMan" after man moves
' Get block number
i = (((imgMan.Top - shpBoard.Top) / intSize) * intNumOfCols) + (imgMan.Left / shpBoard.Left)
If man position = power dot position (top=top & left=left & visible) then
Add 1 or 5 to intScore
Display intScore on lblScore.caption
Make the dot not visible
End If
- Pseudocode for power dots:
' Add to "tmrMan" after seeing if the dot is visible
If block number = one of the corner (power) dots then
Add 5 to IntScore
Else
Add 1 to IntScore
End If
- Test, test, test...
- Modify "vbPacMan" so ghost eats man:
- Declare a new variable named "intManLives" in the Option Explicit & initialize to 5 in the form_load
- Pseudocode for new sub-routine "checkManGhostPosition()":
For ig = 1 To 4
If man top = ghost top And man left = ghost left Then
Decrement (subtract 1 from) intManLives
Select Case intManLives
Case Is > 1: MsgBox display how many lives are left
Case Is = 1: MsgBox display how many lives are left
Case Is < 1: MsgBox display no lives left - Game Over
Set tmrMan.Enabled to False
Set tmrGhost.Enabled to False
End Select
End If
Next ig
- Call "checkManGhostPosition()" after ghost moves & after man moves
- Test, test, test...
|
| 7 |
11/20/07 |
|
Tuesday - English, "vbPacMan" - Ghost Eyes Change & Man Mouth Changes & Ghosts Change Color & Man Eats Ghosts |
|
- Classroom Discussion -
- English - Ms. Gerich will discuss reading newspaper help wanted advertisements
- Lab Assignment -
- Modify "vbPacMan" to alternate the two red ghost images:
- Add a new variable "intGhostNum" initialized in the form_load to 1
- Pseudocode to alternate the two Red ghost images:
' At the top of the ghost timer
If intGhostNum is 1 then
change intGhostNum to 2
Else
change intGhostNum to 1
End If
Load the Red ghost image into the ghost picture property
- Test, test, test...
- Modify "vbPacMan" to open & close the PacMan mouth (waka waka):
- Add a new variable "ingManNum" initialized in the form_load to 1
- Add a new variable "strManDir" initialized in the form_load to "left"
- Pseudocode to alternate the four man images with the correct direction:
' At the top of the man timer
Increment intManNum
If intManNum is greater than 4 then set intManNum back to 1
' Inside the select case intManDir
change case 1: to include setting strManDir to "up"
change case 2: to include setting strManDir to "down"
change case 3: to include setting strManDir to "left"
change case 4: to include setting strManDir to "right"
' After the select case intManDir
Load the PacMan image into the man picture property
- Test, test, test...
- Modify "vbPacMan" to change the ghosts from red to blue whenever the man eats a power dot:
- Add a new timer "tmrGhostColor" enabled = false interval = 10000
- Add a new variable "strGhostColor" initialized in the form_load to ""
- Change the ghost load picture line to include the variable "strGhostColor"
- Pseudocode for Ghost Color timer:
strGhostColor = ""
tmrGhostColor.Enabled = False
- Pseudocode to change the ghosts to blue (scared when man eats power dot):
' Inside the man timer after the man moves
' test for corner (power) dots
' if your board size is different, use different numbers
If i = 1 Or i = 11 Or i = 111 Or i = 121 Then
Add 5 points to score
Set strGhostColor to "Scared"
Set tmrGhostColor.Enabled to True
Else
Add 1 point to score
End If
- Test, test, test...
- Modify "vbPacMan" so that the man gains points when eat a ghost:
- Pseudocode modify sub-routine "checkManGhostPosition()":
For ig = 1 To 4
If man top = ghost top And man left = ghost left Then
If strGhostColor = "" Then
Decrement (subtract 1 from) intManLives
Select Case intManLives
Case Is > 1: MsgBox display how many lives are left
Case Is = 1: MsgBox display how many lives are left
Case Is < 1: MsgBox display no lives left - Game Over
Set tmrMan.Enabled to False
Set tmrGhost.Enabled to False
End Select
Else
Add 50 points to intScore
Display intScore on lblScore
Move the ghost just eaten to the center block
End If
End If
Next ig
- Test, test, test...
|
| 8 |
11/21/07 |
|
Wednesday - Career, "vbPacMan" - Finishing Up |
|
- Classroom Discussion -
- Career - Steps:
- Find the job (advertisement, networking, internal, cold mailing)
- Send a cover letter (convince the reader to look at your résumé)
- Send a résumé (convince the reader to interview you)
- During the interview (convince the interviewer to hire you)
- Send a follow-up thank you letter (remind the interviewer why you're the best candidate)
- Receive a job offer & negotiate perqs (convince the employer to pay you well, this is the first time you talk about salary)
- Send an acceptance letter
- Career - Cover Letter Review:
- One page only
- Business letter format
- Your name & address on top
- The date
- Addressed to a named person (call beforehand to find out who)
- Salutation, "Dear Mr. Gates"
- Each cover leter is customized to be unique & specific about your particular strengths to one particular job
- One page only
- Three to five paragraphs
- Why you're writing, include job title & where you found out
- Why you're qualified, specify one direct reason why you're qualified
- What you'll do next, you'll call to schedule an interview
- Closing, "Sincerely,"
- Repeat your name at the bottom, leaving room for your signature
- Sign in black or blue ink, medium-width pen
- One page only
- Career - Other types of cover letters:
- Lab Assignment -
- Finish up "vbPacMan":
-
-
- Test, test, test...
|
|
11/22/05 |
|
Thursday - Thanksgiving - No School |
|
11/23/05 |
|
Friday - Friday After Thanksgiving - No School |
|
| 9 |
11/26/07 |
|
Monday - Computer Safety & "vbASCII" |
|
- Classroom Discussion -
- Computer Safety - Videos
- ASCII:
- VB6 built-in pre-defined functions:
- Len(string) - Returns a Long value that indicates the number of characters in a string
- Mid(string, start[, length]) - Returns a String value of one or more characters, taken from the String variable specified by the string argument. The start argument specifies the character position within string where the new String is to be obtained, and the optional length argument specifies how many characters are to be taken from string. If no length is specified, then all the characters in string (starting at the position given in the start argument) are used
- Asc(string) - Returns an Integer value that represents the ASCII code for the first character in the string
- Chr(chrcode) - Returns a one-character String value represenging the ASCII character of the number specified by the charcode argument
- Lab Assignment -
- Create a VB program "vbASCII" to convert from normal letters to ASCII code:
- Write the pseudocode
- Design the form
- Add any variables or constants
- Write the program code
- Test & Save frequently Save to your "My Documents" folder & copy to your "Z:" drive
- When complete, copy to your "Z:/toBeGraded" folder so I can grade it
- Create a stand-alone VB program "vbASCII-Quick" that will display the ASCII code for any letter typed
|
| 10 |
11/27/07 |
|
Tuesday - Science & "vbASCII" |
|
- Classroom Discussion -
- Science - How Hard Discs Work:
- ASCII:
- VB6 built-in pre-defined functions:
- Len(string) - Returns a Long value that indicates the number of characters in a string
- Mid(string, start[, length]) - Returns a String value of one or more characters, taken from the String variable specified by the string argument. The start argument specifies the character position within string where the new String is to be obtained, and the optional length argument specifies how many characters are to be taken from string. If no length is specified, then all the characters in string (starting at the position given in the start argument) are used
- Asc(string) - Returns an Integer value that represents the ASCII code for the first character in the string
- Chr(chrcode) - Returns a one-character String value represenging the ASCII character of the number specified by the charcode argument
- Lab Assignment -
- Modify the VB program "vbASCII" to convert from ASCII code to normal letters:
- Write the pseudocode
- Design the form
- Add any variables or constants
- Write the program code
- Test & Save frequently Save to your "My Documents" folder & copy to your "Z:" drive
- When complete, copy to your "Z:/toBeGraded" folder so I can grade it
- Try entering some random ASCII numbers between 0 & 255 to see what text character they represent
|
| 11 |
11/28/07 |
|
Wednesday - Career & "vbMatchGame" |
|
- Classroom Discussion -
- Career - Résumés
- Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 17 - Menus
- Lab Assignment -
- Create a VB program "vbMatchGame" to play the famous game:
- Rules:
- The game board has a picture but is covered by 8 pairs of other pictures randomly arranged in a 4 by 4 square
- All the other pictures are covered by a cover image
- The player clicks on two of the covered images to uncover pairs of images
- The player has to try to match pairs
- If the player finds a matched pair, the pair will disappear & reveal part of the background image
- If the two clicked images don't match, they are recovered with the cover image
- When the player finds all 8 matches, the entire background image is revealed
- Locate appropriate images from the internet or use my images from the "Q:/pcProgramming/vbExamples/matchGame/" folder
- Control objects on the form:
- An image named "imgBoard" top=100 left=100 width=8000 height=8000
- An image named "imgBlock" copied pasted 16 times MAKE A CONTROL ARRAY 1 - 16
- An image named "imgCover" copied pasted 16 times MAKE A CONTROL ARRAY 1 - 16
- A combo box named "cboPictures"
- Variables:
Option Explicit
Declare variable intRow As Integer
Declare variable intCol As Integer
Declare variable i As Integer
Declare constant intNumOfRows As Integer = 4
Declare constant intNumOfCols As Integer = 4
Declare constant intSize As Integer = 2000
Declare variable intRand As Integer
Declare variable strPic(16) As String
Declare variable strBoard(16) As String
- Pseudocode for Form_Load():
call Randomize
'set form size
matchGame.Width = 8300
matchGame.Height = 8900
'set board position & size
set top of imgBoard = 100
set left of imgBoard = 100
set width of imgBoard = 8000
set height of imgBoard = 8000
set stretch of imgBoard = True
Call loadBoard
Call loadBlock
Call loadCover
- Pseudocode for sub-routine loadBoard():
set intRand = Int(Rnd() * 16) + 1
set picture of imgBoard = LoadPicture(strBoard(intRand))
- Pseudocode for sub-routine loadBlock():
add two of each picture to cboPictures using AddItem routine
loop intRow from 1 To intNumOfRows
loop intCol from 1 To intNumOfCols
set variable i equal to (intRow - 1) * intNumOfCols + intCol
set top of imgBlock(i) to (intRow - 1) * intSize + imgBoard.Top
set left of imgBlock(i) to (intCol - 1) * intSize + imgBoard.Left
set width of imgBlock(i) to intSize + 5
set height of imgBlock(i) to intSize + 5
set stretch of imgBlock(i) to True
set visible of imgBlock(i) to False
'randomly place images onto blocks
set intRand to Int(Rnd() * cboPictures.ListCount)
set picture of each imgBlock()= LoadPicture(cboPictures.List(intRand))
'save the names of the images
set strPic(i) to cboPic.List(intRand)
remove each intRand item from cboPictures
end loop intCol
end loop intRow
- Pseudocode for sub-routine loadCover():
loop intRow from 1 To intNumOfRows
loop intCol from 1 To intNumOfCols
set variable i equal to (intRow - 1) * intNumOfCols + intCol
set top of imgCover(i) to (intRow - 1) * intSize + imgBoard.Top
set left of imgCover(i) to (intCol - 1) * intSize + imgBoard.Left
set width of imgCover(i) to intSize + 5
set height of imgCover(i) to intSize + 5
set stretch of imgCover(i) to True
set visible of imgCover(i) to True
end loop intCol
end loop intRow
- In order to see that it works during testing, set the cover visible to false
- When testing is complete, reset cover visible to true
- Test & Save frequently Save to your "My Documents" folder & copy to your "Z:" drive
- When complete, copy to your "Z:/toBeGraded" folder
|
| 12 |
11/29/07 |
|
Thursday - Math & "vbMatchGame" |
|
- Classroom Discussion -
- Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 17 - Menus
- Math - Binary Review: watch video
- Math - Ms. Verde & Hexadecimal numbers
- Lab Assignment -
- Complete the VB program "vbMatchGame" to play the famous game:
- Ideas:
- The player will click on two covers
- The "Index" local variable controls which cover was clicked
- Save the "Index" value in two different global variable: "intClick1" & "intClick2"
- A click to a cover sets the cover visible false & the image visible true
- A timer will allow the images to display for about 1 second
- If the two images match (strPic(1) = strPic(2)), then set both images visible false
- If the two images don't match, then set both images visible false & both covers visible true
- Use menus to load a new game & exit the program
- Add a timer control object named "tmrBlock": enabled = true & interval = 1000
- Add two new variables:
Declare a variable intClick1 As Integer
Declare a variable intClick2 As Integer
Set each to 0 in the form_load()
- On the form, double-click any imgCover to create the sub-routine "imgCover_Click()"
- Pseudocode for imgCover_Click(Index As Integer):
test if intClick1 = 0 Then
set intClick1 to Index
set visible of imgCover(intClick1) to False
set visible of imgBlock(intClick1) to True
else test if intClick2 = 0 Then
set intClick2 to Index
set visible of imgCover(intClick2) to False
set visible of imgBlock(intClick2) to True
set tmrBlock.Enabled to True
end if
- Pseudocode for tmrBlock():
test if strPic(intClick1) = strPic(intClick2) Then
set visible of imgBlock(intClick1).Visible to False
set visible of imgBlock(intClick2).Visible to False
else
set visible of imgBlock(intClick1).Visible to False
set visible of imgCover(intClick1).Visible to True
set visible of imgBlock(intClick2).Visible to False
set visible of imgCover(intClick2).Visible to True
end if
set intClick1 to 0
set intClick2 to 0
set tmrBlock.Enabled to False
- Menu Reminders:
- Must be viewing the form
- Select [T]ools, [M]enu Editor...
- Caption is what the user sees
- Name is what the programmer uses for control
- Add menus:
- New Game & Exit are normally sub-menus under top-level File menu
- Caption = &File & Name = mnuFile
- Caption = &New Game & Name = mnuFileNew & Indent
- Caption = e&Xit & Name = mnuFileExit & Indent
- Pseudocode for menu file exit:
end program
- Pseudocode for menu file new game:
Call loadBoard
Call loadBlock
Call loadCover
- Test & Save frequently Save to your "My Documents" folder & copy to your "Z:" drive
- When complete, copy to your "Z:/toBeGraded" folder
- Add a menu option for instructions on how to play the game
|
| 13 |
11/30/07 |
|
Friday - SkillsUSA & "vbMatchGame" |
|
- Classroom Discussion -
- SkillsUSA - PDP, the Professional Development Program, teaches Employability Skills –
While proper technical skills are undeniably important to employers,
so are employability skills, including the ability to communicate, work on a team,
resolve conflicts, confront ethical dilemmas and manage one's time.
- VB Review
- Binary Review - watch video
- Lab Assignment -
- Finish "vbMatchGame"
|
|
| 14 |
12/03/07 |
|
Monday - Math & VB Quiz 7 & VB Program Quiz "vbBinary" |
|
- Classroom Discussion -
- Review Decimal, Binary, Hexadecimal conversions
- Decimal to Binary:
Divide by powers of 2 remembering the remainder (mod)
Divide by 2 ignoring the decimal (int)
Continue until you reach 0
- Binary to Decimal:
Multiple each binary digit by a power of 2
Sum the result
- Decimal to Hexadecimal:
Divide by powers of 16 remembering the remainder (mod)
Divide by 16 ignoring the decimal (int)
Continue until you reach 0
- Hexadecimal to Decimal:
Multiple each hexadecimal digit by a power of 16
Sum the result
- Lab Assignment -
- Visual Basic Quiz 7. Click the link & follow the instructions. You only get one chance - this is not "try until you score 100". Open notes, open internet, open VB IDE (you may try out your answer in a program before you submit it), you may ask me for clarification, you may NOT ask me for the answers, likewise you may NOT ask another student
- Quiz Part II - Design, write, create, test, run, & save a Visual Basic program to convert from decimal numbers to binary & back:
decimal 2 is binary 00000010
decimal 7 is binary 00000111
decimal 15 is binary 00001111
- Decimal numbers will be between 0 & 255
- No negative decimal numbers
- No decimal numbers larger than 255
- Binary numbers will be between 00000000 & 11111111
- Call your form "frmBinary.frm" & your project "vbBinary.vbp"
- Think before you start
- How will you determine whether to convert from decimal to binary or from binary to decimal?
- How will you get input?
- Is the input numeric or text?
- Decimal to binary, how will you remember whether the remainder is 1 or 0?
- Test & Save frequently Save to your "My Documents" folder & copy to your "Z:" drive
- When complete, copy to your "Z:/toBeGraded" folder so I can grade it
- Grading Criteria:
- Write the pseudocode, add your name & today's date, print & hand in to be graded
- Form must be named
- Form objects (except labels) must be named
- You must have your name, date, & program name as comments at the top of the code
- You must use "Option Explicit"
- Variables must be named & declared
- Exit button must ask if I really want to exit
- Determine button must provide the correct answer to all test input. I will test with the numbers given above
- Output must echo user input so that the user can see & fix his own misteaks
- Output must show the correct answer
- Use enough text in the output to describe what the numbers mean
- Open online book, open notes, you may ask clarification questions but I will not code this for you, you may NOT ask your fellow students for help
- Take as much time as you need to get it right
- Grading (total of 100 pts available):
- Pseudocode (20 pts)
- Must give correct answers (50 pts)
- Has programmer (that's you) name & date as comments at top of code (10 pts)
- Has one or more programmer-written sub-routine or function (10 pts)
- Does something cool not required (10 pts)
- Write the code & give the user options to convert from Decimal to Hexadecimal & Hexadecimal to Decimal
|
| 15 |
12/04/07 |
|
Tuesday - Science & "vbColorChart" |
|
- Classroom Discussion -
- Science - CPU - Sources:
- Lab Assignment -
- Create a Visual Basic program "vbColorChart" that uses slider bars & hexadecimal numbers to display different color choices to the user:
- Copy "vbQuotes", rename as "vbColorChart"
- VB Code segment to change background color to an RGB() value:
lblOut.BackColor = RGB(CInt(txtRed.Text), CInt(txtGreen.Text), CInt(txtBlue.Text))
- Add 3 Textbox Objects named "txtRed", "txtGreen", & "txtBlue", set the text property to 0
- Add 3 Scrollbar Objects named "vsbRed", "vsbGreen", & "vsbBlue", set minimum to 0 & maximum to 255
- Add labels as appropriate to identify other objects
- Pseudocode for when the value in the "txtRed" textboxes changes:
if the text value is >= 0 and the text value is <= 255 then
change the value of the "vsbRed" scrollbar to be the value of the "txtRed" textbox
change the background color of the "lblOut" output label using the "RGB()" command
else
change the value of the "txtRed" textbox to be the value of the "vsbRed" scrollbar
end if
- Pseudocode for when the "vsbRed" scrollbar changes:
change the value of the "txtRed" textbox to be the value of the "vsbRed" scrollbar
- Test
- Repeat the above code for "txtGreen" & "vsbGreen"
- Repeat the above code for "txtBlue" & "vsbBlue"
- Add 3 more Textbox Objects named "txtRed2", "txtGreen2", & "txtBlue2"
- Add 3 more Scrollbar Objects named "vsbRed2", "vsbGreen2", & "vsbBlue2"
- Add code so that the second set of textboxes control the foreground color
- Add code so that the second set of scrollbars control the second set of textboxes
- Test
- To make it easier for the user, setup the 6 new textboxes so that by clicking or tabbing into the box, SetFocus highlights the contents
|
| 16 |
12/05/07 |
|
Wednesday - Career & "vbColorChart" |
|
- Classroom Discussion -
- Career - Résumés
- Lab Assignment -
- Continue with "vbColorChart"
|
| 17 |
12/06/07 |
|
Thursday - English & "vbLeet" |
|
- Classroom Discussion -
- English - Completing job applications
- Lab Assignment -
- Create a new Visual Basic program "vbLeet" to convert normal text into "1337"
- Create a new VB executable
- Add 2 Textbox Objects named "txtIn" & "txtOut"
- Add 3 Command Button Objects named "cmdToLeet", "cmdToNormal", & "cmdExit"
- Pseudocode for "cmdExit":
end
- Pseudocode for "cmdToLeet":
if txtIn.Text is not blank Then
set variable strIn to be the value in txtIn.Text
set variable strOut to be blank
loop from 1 To length of strIn
set variable s to be one letter from variable strIn
select case s
case "A": add string "4" to variable strOut
case "a": add string "@" to variable strOut
case "B": add string "|3" to variable strOut
case "b": add string "|." to variable strOut
case "C": add string "(" to variable strOut
case "c": add string "©" to variable strOut
case "D": add string & "|)" to variable strOut
case "d": add string & ".|" to variable strOut
case "E": add string & "3" to variable strOut
case "F": add string & "|=" to variable strOut
case "G": add string & "6" to variable strOut
case "g": add string & "q" to variable strOut
case "H": add string & "|-|" to variable strOut
case "h": add string & "4" to variable strOut
case "R": add string & "®" to variable strOut
' repeat for all possible NORMAL to LEET letter combinations
Case Else: add value in variable s to variable strOut
end select
end loop i
display the value in variable strOut onto the textbox txtOut
end if
- Pseudocode for "cmdToLeet":
if txtIn.Text is not blank Then
set variable strIn to be the value in txtIn.Text
set variable strOut to be blank
loop from 1 To length of strIn
set variable s to be one letter from variable strIn
select case s
case "4": add string "A" to variable strOut
case "@": add string "a" to variable strOut
case "(": add string "C" to variable strOut
case "©": add string "c" to variable strOut
case "3": add string & "E" to variable strOut
case "6": add string & "g" to variable strOut
case "®": add string & "R" to variable strOut
case ".":
if the next letter is "|" then add string "d" to variable strOut & add 1 to i
case "|":
if the next letter is "3" then add string "B" to variable strOut & add 1 to i
if the next letter is "." then add string "b" to variable strOut & add 1 to i
if the next letter is ")" then add string "D" to variable strOut & add 1 to i
if the next letter is "=" then add string "F" to variable strOut & add 1 to i
if the next 2 letters are "-|" then add string "H" to variable strOut & add 2 to i
' repeat for all possible LEET to NORMAL letter combinations
Case Else: add value in variable s to variable strOut
end select
end loop i
display the value in variable strOut onto the textbox txtOut
end if
- Add labels as appropriate to identify other objects
- Test
- Write code to have different LEET combinations translate to the same NORMAL letters: For instance having both "®" & "|4" translate to "R"
|
| 18 |
12/07/07 |
|
Friday - SkillsUSA & "vbLeet" |
|
- Classroom Discussion -
- SkillsUSA
- Lab Assignment -
- Continue the "vbLeet" program
|
|
| 19 |
12/10/07 |
|
Monday - English & "vbRoman" |
|
- Classroom Discussion -
- English -
- doit.ort.org - cool (hardware, software, languages, develop, present, networks, internet)
- Programming Steps: wikipedia.org - The Waterfall Model
- Requirements specification
- Design
- Construction (AKA implementation or coding)
- Integration
- Testing and debugging (AKA validation)
- Installation
- Maintenance
- Definition: Program Specification: the definition of what a computer program is expected to do
- Writing Program Development Specifications:
- wikipedia.org - Roman Numbers
- Lab Assignment -
- Write Program Development Specification for a computer program that will display the Roman number equavalent of a decimal number or a decimal number equavalent of a Roman number. Name & date on top & print & hand in
- Create a Visual Basic 6 program named "vbRoman" to display the Roman number equavalent of a decimal number or a decimal number equavalent of a Roman number:
- Assumptions:
- The user will enter a positive integer number between 1 & 5000
- Variables:
intNum
strNum
i
intHowMany
- Pseudocode for decimal to Roman:
get value of input integer variable "intNum" from input textbox "txtIn.text"
clear output string variable "strNum"
find how many thousands by dividing "intNum" by 1000, retaining integer part (don't round)
loop to add how many "M" to output "strNum"
find how many hundreds by dividing "intNum" by 100, retaining integer part (don't round)
if 9 hundreds add "CM" to output "strNum"
if 4 hundreds add "CD" to output "strNum"
loop to add how many "C" to output "strNum"
find how many tens by dividing "intNum" by 10, retaining integer part (don't round)
if 9 tens add "XC" to output "strNum"
if 4 tens add "XL" to output "strNum"
loop to add how many "X" to output "strNum"
find how many ones by dividing "intNum" by 100, retaining integer part (don't round)
if 9 ones add "IX" to output "strNum"
if 4 ones add "IV" to output "strNum"
loop to add how many "I" to output "strNum"
display output "strNum" to user by replacing "txtOut.text"
- Write the code
- Test:
| Decimal | Roman |
| 2007 | MMVII |
| 1999 | MCMXCIX |
| 666 | DCLXVI |
| 555 | DLV |
| 444 | CDXLIV |
|
| 20 |
12/11/07 |
|
Tuesday - Science & "vbRoman" |
|
- Classroom Discussion -
- Science - howstuffworks.com - How do touch-screen monitors know where you're touching?
- Lab Assignment -
- Modify the VB program named "vbRoman":
- Assumptions:
- The user will enter a Roman number between I & MMMMM
- All characters input will be one of the Roman numbers: "M", "D", "C", "L", "X", "V", or "I"
- The Roman numbers will be in the correct Roman number order as listed above
- Smaller Roman numbers may not appear before larger Roman numbers with these exceptions:
- 1 "C" may come before 1 "M"
- 1 "C" may come before 1 "D"
- Not both
- 1 "X" may come before 1 "C"
- 1 "X" may come before 1 "L"
- Not both
- 1 "I" may come before 1 "X"
- 1 "I" may come before 1 "V"
- Not both
- Variables: no additional variables are needed
- Pseudocode for Roman to decimal:
get input string variable "strNum" from input textbox "txtIn.text"
clear output integer variable "intNum" to zero (to add additional value)
get variable "intHowMany" as length of input string variable "strNum"
loop to process every character in "strNum"
for every "M", add 1000 to "intNum"
for any "CM", add 900 to "intNum"
for any "D", add 500 to "intNum"
for any "CD", add 400 to "intNum"
for every "C", not followed by an "M" or "D", add 100 to "intNum"
for any "XC", add 90 to "intNum"
for any "L", add 50 to "intNum"
for any "XL", add 40 to "intNum"
for every "X", not followed by an "C" or "L", add 10 to "intNum"
for any "IX", add 9 to "intNum"
for any "V", add 5 to "intNum"
for any "IV", add 4 to "intNum"
for every "I", not followed by an "X" or "V", add 1 to "intNum"
- Write the code
- Test:
| Roman | Decimal |
| MMVII | 2007 |
| MCMXCIX | 1999 |
| DCLXVI | 666 |
| DLV | 555 |
| CDXLIV | 444 |
|
| 21 |
12/12/07 |
|
Wednesday - Career & "vbDiscounter" |
|
- Classroom Discussion -
- Career - résumé.ppt - PowerPoint Presentation
- Lab Assignment -
- Create a VB6 program to calculate item purchase discounts:
- Concept:
- There's an item on sale
- You know the original price
- You know either the discount percent or the discount amount or the discount price
- You want to know the other amounts
- Program Specification:
- Inputs:
- original price, in a textbox named "txtOriginalPrice"
- discount price, in a textbox named "txtDiscountPrice"
- discount percent, in a textbox named "txtDiscountPercent"
- discount amount, in a textbox named "txtDiscountAmount"
- Processes: Given original price and one of the above, calculate the remaining two:
- discount amount / original price = discount percent
- original price * discount percent = discount amount
- original price - discount amount = discount price
- original price - discount price = discount amount
- Outputs: the remaining amounts into the appropriate textboxes
- User events:
- Command button named "cmdProcess" to process
- Command button named "cmdClear" to clear all
- Command button named "cmdExit" to exit
- Variables:
global single variable for original price
global single variable for discount amount
global single variable for discount price
global single variable for discount percent
- Pseudocode:
"txtOriginalPrice" must not be blank
one more of "txtDiscountPrice" or "txtDiscountPercent" or "txtDiscountAmount" must be not blank
if user enters "txtOriginalPrice" and "txtDiscountPrice" then calculate "txtDiscountPercent" and "txtDiscountAmount"
elseif user enters "txtOriginalPrice" and "txtDiscountAmount" then calculate "txtDiscountPrice" and "txtDiscountPercent"
elseif user enters "txtOriginalPrice" and "txtDiscountPercent" then calculate "txtDiscountAmount" and "txtDiscountPrice"
display all to user
- Write the code
- Test:
Original Price | Discount Amount | Discount Price | Discount Percent |
| 150 | 50 | 100 | 33.33 |
|
| 22 |
12/13/07 |
|
Thursday - Math & "vbTipCalculator" |
|
- Classroom Discussion -
- Math - Ms. Verde & the Math of Snow
- caltech.edu - atomic microscope photos of snow crystals
- Fractal Videos from youtube.com
- Videos of Wizards in Winters
- neverEnoughLights.com - house lights to winter music
- Lab Assignment -
- Create a VB6 program to calculate tips in a restaurant:
- Concept:
- You are charged an amount (including tax) for food service
- You need to determine how much TIP to include for the server
- Service has been either Mediocre, Satisfactory, or Outstanding:
- Mediocre deserves 10% TIP
- Satisfactory receives 15% TIP
- Outstanding achieves 20% TIP
- You need to know what the TIP is & how much the total is
- Program Specification:
- Inputs:
- total amount
- type of service (Mediocre, Satisfactory, or Outstanding)
- Processes: calculate the TIP & total charge:
- type of service:
- Mediocre TIP is total amount * .10
- Satisfactory TIP is total amount * .15
- Outstanding TIP is total amount * .20
- total charge is total amount + TIP
- Outputs: TIP & total charge
- User events:
- Radio button group named "optTip" for Mediocre, Satisfactory, Outstanding
- Command button named "cmdTip" to calculate TIP & total charge
- Command button named "cmdClear" to clear all
- Command button named "cmdExit" to exit
- Variables:
single variable for total amount
single variable for TIP percentage
single variable for TIP amount
single variable for total charge
- Pseudocode:
total amount must be numeric
one of the three radio buttons (Mediocre, Satisfactory, or Outstanding) must be checked
if Mediocre is checked then TIP percentage is .10
elseif Satisfactory is checked then TIP percentage is .15
else TIP percentage is .20
TIP amount is total amount times TIP percentage
total charge is total amount plus TIP amount
display results to user
- Write the code
- Test:
Total Amount | Type of Service | TIP Percentage | TIP Amount | Total Charge |
| 25.00 | Mediocre | .10 | 2.50 | 27.50 |
| 25.00 | Satisfactory | .15 | 3.75 | 28.75 |
| 25.00 | Outstanding | .20 | 5.00 | 30.00 |
| 50.00 | Mediocre | .10 | 5.00 | 55.00 |
| 50.00 | Satisfactory | .15 | 7.50 | 57.50 |
| 50.00 | Outstanding | .20 | 10.00 | 60.00 |
| 75.00 | Mediocre | .10 | 7.50 | 82.50 |
| 75.00 | Satisfactory | .15 | 11.25 | 86.25 |
| 75.00 | Outstanding | .20 | 15.00 | 90.00 |
|
| 23 |
12/14/07 |
|
Friday - SkillsUSA & Quiz |
|
- Classroom Discussion -
- Game Development Contest:
- njit.edu - Game Expo : April 19th, 2008
- njit.edu - Discusses Video Game Programming
- Lab Assignment -
|
|
| 24 |
12/17/07 |
|
Monday - Pledge & Math & "vbNumberGuess" |
|
- Classroom Discussion -
- NJIT High School Game Development Contest - I got an answer to my question about rules:
Hello Mike,
The rules are simple:
The work must be done by students (with teacher guidance of course).
Students may use any method of development:
- Use of web style technologies (flash, gamemaker, etc)
- Modifying an existing game (unreal, warcraft III, etc)
- Development from scratch.
Since this event is sponsored by our College of Computing Sciences,
extra attention will be payed to any programming and technical
development. All aspects of game development (art, level design, game
design, programming & audio) will be considered by our staff and
industry judges.
Students must be present at the event to showcase their game. You must
bring your own computers to demonstrate your work on.
If you win, you can't re-submit the same project for any future Game
Expo's.
Good luck and happy development,
-DJ Kehoe
Information Technology Program
New Jersey Institute of Technology
- Continue thinking about what game(s) you might want to develop as a class project in Marking Period 3 while we learn C++
- Review of random number generator:
- Random numbers are really just an already defined Visual Basic table of numbers between 0.0 & 0.9999
- Random numbers are really only "pseudo-random" because, if you know the starting point & you know the sequence, you can predict the next random number
- "Randomize" in "Form_Load()"
- "Randomize" helps to make the random numbers look more random because the starting number is based on the milliseconds of the clock cycle
- Dim "intLowNum" as integer for the lowest random number you want
- Dim "intHighNum" as integer for the highest random number you want
- Dim "intRand" as integer to remember the random number
- Use the pre-defined built-in VB6 function "Rnd()" to return a random number between 0.0 & 0.9999
- Use the pre-defined built-in VB6 function "Int()" to return just the integer part
- "intRand = Int(Rnd() * (intHigh - intLow)) + intLow"
- To get a random number between 0 & 7 use "intRand = Int(Rnd() * 8)"
- To get a random number between 1 & 2 use "intRand = Int(Rnd() * 1) + 1"
- To get a random number between 1 & 6 use "intRand = Int(Rnd() * 6) + 1"
- To get a random number between 1 & 100 use "intRand = Int(Rnd() * 100) + 1"
- To get a random number between 50 & 60 use "intRand = Int(Rnd() * 10) + 50"
- Lab Assignment -
- Create a Visual Basic program called "vbNumberGuess" to play the game:
- The computer will generate a random number between 1 & 100, inclusive, & the user has 7 chances to guess the correct number
- Program Specification:
Inputs:
user event new game
user number
user event guess
user event exit
Outputs:
"Your guess is too high"
"Your guess is too low"
"You guessed my number"
Storages: none
Processes:
generate a random number between 1 & 100
get the user guess
determine if the user guess is too high, too low, or right on
determine how many guesses the user has used
determine if how many guesses is greater than 7
tell the user what happened
- Pseudocode:
write your own pseudocode
- :Variables:
create your own variables
- Test
- Save
- Use a winter-theme
|
| 25 |
12/18/07 |
|
Tuesday - Pledge & Science & "vbSlotMachine" |
|
- Classroom Discussion -
- Science - webopedia.com - The 7 Layers of the OSI Model
- Physical Layer - hardware
- Data Link Layer - bits
- Network Layer - switching & routing
- Transport Layer - transfer of data
- Session Layer - establishes, manages and terminates connections
- Presentation Layer - independence from differences in data representation
- Application Layer - end-user processes
- Lab Assignment -
- Create a Visual Basic program called "vbSlotMachine" to play the game:
- The computer will display three images, if images don't match, user loses points, if images match, user gains points
- Program Specification:
Inputs:
user event will start three images displays "rolling"
user event will stop first image
user event will stop second image
user event will stop third image
Outputs:
display three images
display user score
Storages: none
Processes:
there are 8 possible images to try & match
when the user clicks start, display different images as if the "slot machine" was rolling
when the user clicks stop, randomly stop the image
if any two images match, add 10 points to the user score
if all three images match, add 100 points to the user score
when the user clicks exit, end the program
- Pseudocode:
write your own pseudocode
- :Variables:
create your own variables
- Test
- Save
- Use a winter-theme
|
| 26 |
12/19/07 |
|
Wednesday - Pledge & Career & "vbMagic8Ball" |
|
- Classroom Discussion -
- Start your résumé
- Make a list of your job experiences
- Make a list of your education, high school or above
- Make a list of your knowledge & skill set
- Be sure to quantify any examples you use (numbers: reduced expenses by 10%, increased sales by 10%)
- Think about what you want to do in the next year or two
- Based on your experiences, education, skills, & wants, write a reasonable, achievable objective
- Use Notepad or Word & save to your "Z:/OtherAssignments" folder named "resumeIdeas"
- Lab Assignment -
- Create a Visual Basic program called "vbMagic8Ball" to play the game:
- The computer will display an answer to a question the user asks
- Program Specification:
Inputs:
user will verbally ask the computer program a question
user will click a button to "Tell Fortune"
Outputs:
display a random answer to the user question
Storages: none
Processes:
when the user clicks to tell fortune, choose a random answer from amoung 8 possible answers
when the user clicks exit, end the program
- Pseudocode:
write your own pseudocode
- :Variables:
create your own variables
- Test
- Save
- Use a winter-theme
|
| 27 |
12/20/07 |
|
Thursday - Pledge & Science & Networking Lab |
|
- Classroom Discussion -
- howStuffWorks.com - How Home Networking Works
- Lab Assignment -
- Setup & test a network in class using three Microsoft X-Boxes
- Test the X-Box network
|
| 28 |
12/21/07 |
|
Friday - Pledge & SkillsUSA & Complete any Unfinished Assignments |
|
- Classroom Discussion -
- None
- Lab Assignment -
- Take any quizzes you havent taken
- Complete any unfinished assignments
- Work to make a good program better
|
|
|
12/24/07 |
|
Monday - Winter Break - No School |
|
12/25/07 |
|
Tuesday - Winter Break - No School |
|
12/26/07 |
|
Wednesday - Winter Break - No School |
|
12/27/07 |
|
Thursday - Winter Break - No School |
|
12/28/07 |
|
Friday - Winter Break - No School |
|
|
12/31/07 |
|
Monday - Winter Break - No School |
|
01/01/08 |
|
Tuesday - Winter Break - No School |
| 29 |
01/02/08 |
|
Wednesday - Career & Microsoft Access & "vbMembers" |
|
- Classroom Discussion -
- Career - Résumé - Use the résumé ideas from a couple of weeks ago to start creating your résumé:
- The most relevant information at the top
- Use the résumé most likely to get you the job:
- If your most recent job is similar to the job you want, use an experience résumé
- If you're still in school or just graduating, use an educational résumé
- If your skills are most relevant, use a skills (combined) résumé
- Quantify whenever possible:
- "Increased sales 15%"
- "Resulted in savings of $40,000"
- "Eoubled the number of customers"
- Use bullet statements instead of full sentences
- Skip your liabilities or lack of precise skills
- Stress the skills you have that almost match'
- Pay attention to details:
- Mispelings are résoomé killsers
- UORA - Use only relevant acronyms
- Keywords - Grab the reader's attention
- Whitespace - Focus the reader's eyes
- Consise - One page only
- Career - Résumé filename - You might send your résumé electronically as an e-mail attachment:
- Pick a meaningful filename: "Michael Clarke Resume.doc" instead of "myResume.doc"
- Attach as a Microsoft Word document file
- txt vs. doc
- Microsoft Access -
- microsoft.com
- bcSchools.net
- fgcu.edu
- Visual Basic 6 & Database Tutorial -
- profsr.com
- devdos.com
- Add a Data Object to connect to the database & table:
- Name it
- Caption it
- Set database property
- Set recordsource property
- Works like a CD player
- Add a Textbox Object to connect to each field in the database table:
- Name it
- Caption it
- Set datasource property to the data object name
- Set datafield property to the database field name
- Will automagically change when you change the data object
- Will automagically update the database automagically
- Lab Assignment -
- Start a résumé - Google Images
- Create a database called "member" using Microsoft Access:
- Database name "member"
- Table name "member"
- Field:
- key, autonumber, primary key
- id, text, user id
- pw, text, user password
- fName, text, user first name
- lName, text, user last name
- street, text, street address where user lives
- city, text, city where user lives
- state, text, state where user lives
- zip, text, zip code where user lives
- eMail, text, user e-mail address
- Create a Visual Basic program "vbMembers" to read data from the Microsoft Access database "members":
- Copy my version of the Microsoft Access database "member" from the folder "Q:/pcProgramming/vbExamples/"
- Create a new executable
- Add & code an exit button or menu option
- Add a data object named "dtaMember", connect to the database "member", connect to the recordsource "member"
- Add a textbox object (named appropriatly) for each field in the database
- Connect each textbox object to the appropriate datasource & datafield
- Test, test, test
|
| 30 |
01/03/08 |
|
Thursday - Math & Microsoft Access & "vbMembers" |
|
- Classroom Discussion -
- Ms. Verde will visit & discuss matrix math
- Microsoft Access -
- microsoft.com
- bcSchools.net
- fgcu.edu
- Lab Assignment -
- Complete a math worksheet on matrix math
- Modify the Visual Basic program "vbMembers" to create our own movement buttons:
- Add a command button object named "cmdFirst" with the caption "First"
- Add code to move to the first recordset in the data object
- Test
- Add a command button for "Last"
- Add code to move to the last recordset in the data object
- Test
- Add a command button for "Back"
- Add code to move to the previous recordset in the data object
- If "Back" takes you to the beginning of file (BOF), go to the last record
- Test
- Add a command button for "Next"
- Add code to move to the next recordset in the data object
- If "Next" takes you to the end of file (EOF), go to the first record
- Test, test, test
- Disable "First" & "Back" when at the first recordset, disable "Next" & "Last" when at the last recordset, re-enable the buttons appropriately
- Create & code menus for "First", "Back", "Next", & "Last"
|
| 31 |
01/04/08 |
|
Friday - SkillsUSA & Microsoft Access & "vbMembers" |
|
- Classroom Discussion -
- SkillsUSA - The PDP Professional Development Program blue book
- Microsoft Access -
- microsoft.com
- bcSchools.net
- fgcu.edu
- Lab Assignment -
- Distribute PDP blue books
- Work the first lesson
- Modify the Visual Basic program "vbMembers" to search:
- Add a textbox object named "txtSearch"
- Add a global boolean variable "blnFirstSearch" set to "True" in the form_load
- Add a command button object named "cmdSearch"
- Add code to ensure that "txtSearch" is not blank
- If "blnFirstSearch" then find the first recordset in the data object where "fName='" & txtSearch.text & "'"
- Test
- Else find the next recordset in the data object where "fName='" & txtSearch.text & "'"
- Test, test
- Add a command button object named "cmdClearSearch"
- Add code to:
- Clear the search textbox
- Set "blnFirstSearch" back to "True"
- Move to the first recordset in the data object
- Set the focus to the search textbox
- Test, test, test
- Make clickable only after the search button is clicked "cmdClearSearch", disable "cmdClearSearch" when it is clicked
- Create & code menus for "Search" & "ClearSearch"
|
|
| 32 |
01/07/08 |
|
Monday - Character Education & SQL & "vbMembers" |
|
- Classroom Discussion -
- Character Education - goodCharacter.com - Fairness
- SQL - sqlCourse.com - Welcome, Intro, Selecting Data
- Definition - Wildcard - A symbol that stands for one or more unspecified characters, used especially in searching text and in selecting multiple files or directories
- Note: With normal SQL, the wildcard character is "%" percent; with Microsoft Access SQL, the wildcard character is "*" asterisk
- Lab Assignment -
- Modify "member2002.mdb" to add two new tables & create relationships:
- Open "member2002.mdb"
- Add a table named "club" with two fields:
- key, autonumber, primary key
- clubName, text
- Create some records with club names
- Add a table named "memberclub" with three fields:
- key, autonumber, primary key
- memberID, number, will link relationship to key field in member table
- clubID, number, will link relationship to key field in club table
- Create the relationships:
- Close any open tables & click the "member2002" tables tab
- Select menu option "tools" then "relationships"
- Add all three tables "member", "club", "memberclub"
- Click & drag "key" field in the "club" table to the "clubid" field in the "memberclub" table, click to checkbox "Enforce Referential Integrity", click [OK]
- Click & drag "key" field in the "member" table to the "clubid" field in the "memberclub" table, click to checkbox "Enforce Referential Integrity", click [OK]
- Modify the design of the "memberclub" table so that the "memberID" field will "lookup" data in the "member" table
- Modify the design of the "memberclub" table so that the "clubID" field will "lookup" data in the "club" table
- Add some records to the "memberclub" table using the drop-down menus created by the "lookup", allow some to be members of more than one club
- Modify your "vbMember" Visual Basic 6 program to use the new tables:
- Remember that Visual Basic 6 does not work with Microsoft Access 2002 database; you must convert from 2002 to 97 first
- Add a new data object named "club", set the databasename to the converted 97 database, set the recordsource to the "club" table
- Add a new data object named "memberclub", set the databasename to the converted 97 database, set the recordsource to the "memberclub" table
- Test (does no work but you should get no errors either)
|
| 33 |
01/08/08 |
|
Tuesday - Science & SQL & "vbMembers" |
|
- Classroom Discussion -
- Non-traditional class visit - ocvts.org - choose another class it this building to visit
- Science - howStuffWorks.com - the Wii
- SQL - sqlCourse2.com - Welcome, Intro, SELECT, Aggregate, GROUP BY, HAVING
- Microsoft Access - trigonblue.com - Lookup Tables
- Lab Assignment -
- Modify "member2002.mdb" to fix the lookup tables:
- Open the Microsoft Access database called "member2002.mdb"
- Edit the relationships
- Right-click & delete any existing relationships
- Close (& save if asked) the relationships window
- Edit the table "memberclub"
- Click the "data type" column for the "memberID" row
- Select the last item on the drop-down list: "Lookup Wizard"
- 1st screen, The wizard creates? Ensure the first radio button "lookup column to look up values" is checked, click "Next"
- 2nd screen, Which table? Select the correct table: "memberID" field value will lookup in the "member" table, click "Next"
- 3rd screen, Which fields? Select "key" & "id" fields, click "Next"
- 4th screen, How wide? Ensure that "Hide key column (recommended)" is checked, click "Next"
- 5th screen, What label? Leave the default or enter a new column name, click "Finish"
- Save the table
- Test by viewing the datasheet & entering or changing some memberIDs
|
| 34 |
01/09/08 |
|
Wednesday - Career & SQL & "vbMembers" |
|
- Classroom Discussion -
- Career - bls.gov - US Bureau of Labor Statistics
- Career - bls.gov/oco - Occupational Outlook Handbook
- SQL - sqlCourse2.com - GROUP BY, HAVING
- Lab Assignment -
- Perform career-oriented research:
- Browse to the Occupational Outlook Handbook website
- Search for "computer" related jobs
- Pick one that sounds interesting
- Read about the interesting career
- Decide if you would want to work in that career field for 40+ years
- Write a short paragraph using Microsoft Word about why you would want to work in that career field for 40+ years
- Name & Today's Date & Title of Career Field on top, save to "Z:/otherAssignments" as filename "css## What I Want to Be"
- Copy the newest version of "member97.mdb" from "Q:/pcProgramming/vbExamples" to your vb folder
- Modify "vbMember" Visual Basic 6 program to display all clubs for each member:
- Add a data object "dtaMemberClub" with database name "member97.mdb" & record source "memberClub" table
- Add a data object "dtaClub" with database name "member97.mdb" & record source "club" table
- Add a textbox object "txtMemberKey" to hold the primary key value from the "key" field of the records in the "dtaMember" table
- Add a textbox object "txtClubKey" to hold the primary key value from the "clubID" field of the records in the "dtaMemberclub" table
- Add a textbox object "txtClubName" to hold the name value from the "clubName" field of the records in the "dtaClub" table
- Add a listbox object "lstClubs" to hold the club names from the "dtaClub" table
- Declare two new global variables:
"sqlA" as string
"sqlB" as string
- Pseudocode for a new sub-routine to search for all clubs of which each member is a member:
clear lstClubs
move to the first recordset in dtaMemberClub table
move to the first recordset in dtaClub table
set sqlA so that the memberID field in dtaMemberClub matches the value in txtMemberKey
find the FIRST recordset in dtaMemberClub for sqlA
if not nomatch for recordset in dtaMemberClub then
set sqlB so that the key field in dtaClub matches the value in txtClubKey
find the FIRST recordset in dtaClub table for sqlB
add the value in txtClubName to lstClubs
do until EOF for recordset in dtaMemberClub table
find the NEXT recordset in dtaMemberClub for sqlA
if nomatch for recordset in dtaMemberClub then exit do
set sqlB so that the key field in dtaClub matches the value in txtClubKey
find the FIRST recordset in dtaClub table for sqlB
add the value in txtClubName to lstClubs
loop
end if
- Test - if you use the most recent copy of my "member97.mdb" database from the folder "Q:/pcProgramming/vbExamples/" then you should get the same results as the demo image from yesterday
|
| 35 |
01/10/08 |
|
Thursday - English & SQL & "vbMembers" |
|
- Classroom Discussion -
- English - Ms. Gerick will discuss cover letters
- SQL - sqlCourse2.com - ORDER BY, SQL Boolean
- Lab Assignment -
- Modify "vbMember" Visual Basic 6 program to search one club by name & display all members in a message box:
- Add a combobox object "cboSearchClub"
- Add a boolean variable "blnFirstClubSearch", initialize in Form_Load to true
- Pseudocode for "cboSearchClub_Click()":
if blnFirstClubSearch then
clear lstSearchClubs
move to the first recordset in dtaClub table
do until EOF for recordset in dtaClub.Recordset table
add the value in txtClubName to lstClubs
move to the next recordset in dtaClub table
loop
set blnFirstClubSearch to false
else
set the text property of txtClubName to lstSearchClubs.List(lstSearchClubs.ListIndex)
call searchClub
end if
- Test
- Using club name to search for all members is not working yet...
|
| 36 |
01/11/08 |
|
Friday - SkillsUSA & SQL Quiz & Create-a-Database-Quiz & vbDatabase Quiz |
|
- Classroom Discussion -
- A moment of silence of respect for Sir Edmund Hillary - the first man to ???
- SkillsUSA - nj-skillsUSA.org - Regional & State contests on Feb 2nd at the Brick Center
- SQL - sqlCourse2.com - For review
- Lab Assignment -
- Quiz - SQL Quiz 1. Click the link & follow the instructions. You only get one chance - this is not "try until you score 100". Open notes, open internet, open VB IDE (you may try out your answer in a program before you submit it), you may ask me for clarification, you may NOT ask me for the answers, likewise you may NOT ask another student
- Quiz - Create a Microsoft Access database named "bond":
- Create a new folder named "Z/vb/bond/"
- Open Microsoft Access
- Create & save to your "Z/vb/bond/" folder a new empty database named "bond"
- Create a table "movies" with these fields:
- fieldName, fieldDataType ' info about what data the field will contain
- key, autonumber, primary key
- title, text ' to hold the title of the James Bond movie
- star, text ' name of the actor in the primary role of Bond
- villain, text ' name of the actor who played the role of the villain
- femaleLead, text ' name of the actress who played the leading female role
- released, date ' year the film was released
- Search the Internet to find data & populate your database table with real information
- Save to your "Z:/vb" in a folder named "bond"
- Database grading criteria:
- 20 pts - correct database name ("bond")
- 20 pts - correct field names ("key", "title", etc.)
- 20 pts - correct field data types ("autonumber", "text", etc.)
- 20 pts - has at least 5 records with different staring actor's names ("Sean Connery", "Roger Moore", etc.)
- 20 pts - because I like you all (I really do, most of the time...)
- Quiz - Create a simple Visual Basic program to read data from the database "bond":
- Open Visual Basic
- Create a new executable named "vbBond"
- Save to your "Z/vb/bond/" folder
- Name the form
- Design the form
- Add a data object to connect to the database & recordsource
- Add textbox objects to display values in the database table fields
- Connect textbox objects to the correct datasource & datafields
- Add label objects to identify values in textbox objects
- Add a command button object & code to exit the program
- There is no other code required - let the user use the data object to control recordset movement
- Test
- Visual Basic program grading criteria:
- 25 pts - started but doesn't work, form has some objects
- 25 pts - work-in-progress but doesn't work, form all of the objects required in order to work
- 25 pts - works, correctly displaying all fields from the database
- 10 pts - correct Hungarian Notation object & variable(?) names (txtThis & dtaThat & cmdThose)
- 10 pts - exit command button asks "Really Exit?" (or something similar)
- 5 pts - visually & asthetically appealing (I like how it looks)
|
|
| 37 |
01/14/08 |
|
Monday - SQL & More Than One VB Form & "vbMembers" |
|
- Classroom Discussion -
- Human Multi-tasking - Does it work?
- RED vs. BLUE:
- SQL - sqlCourse2.com - SELECT from multiple tables by joining tables
- Lab Assignment -
- Add a "splash screen" to your Visual Basic program "vbMembers":
- Open your existing VB6 program "vbMembers"
- Create a new form using menu option [P]roject, Add [F]orm
- Name the new form "frmMain"
- Make the new form the "startup object" using menu option [P]roject, Project Prop[e]rties...
- In the wizard window that opens, change the "startup object" to be "frmMain"
- Add label objects something like "Welcome to Members Database" & "Please Standby..."
- Add a timer object named "tmrMain", Enabled = True, Interval = 2000
- Pseudocode for the timer object:
set the "frmMember" visible to True
set the "frmMain visible to False
- Test, the main form will display for about 2 seconds, then the main form will disappear & the member form will appear
- Modify the "frmMain" to include command buttons to give the user more control:
- Disable the timer "tmrMain"
- Add a command button object "cmdDisplay" to display existing members
- Pseudocode for "Display":
set the "frmMember" visible to True
set the "frmMain visible to False
- Test, click to "cmdDisplay", the main form will disappear & the member form will appear
- But, the command button object "cmdExit" on "frmMembers" will still exit the program
- Modify the command button object "cmdExit" on the form "frmMembers" to close the members form & open the main form
- Pseudocode:
set the "frmMember" visible to False
set the "frmMain visible to True
- Test, the form "frmMembers" will hide & the form "frmMain" will display
- Add a command button object "cmdAdd" to add new members
- Add a command button object "cmdUpdate" to update existing members
- Add a command button object "cmdDelete" to delete existing members
|
| 38 |
01/15/08 |
|
Tuesday - Science & SQL & "vbMembers" |
|
- Classroom Discussion -
- Science - howStuffWorks.com - how money is made
- Science - howStuffWorks.com - how Playstation 3 works
- Science - howStuffWorks.com - CES 2008
- SQL - sqlCourse.com - INSERT INTO
- VB6 Tutorial - profsr.com - working with a database
- Lab Assignment -
- Modify "vbMembers" to include a form to add new members:
- Add a new form "frmAdd"
- Pseudocode for form "frmMain" control button object "cmdAdd":
show the new form "frmAdd"
hide the form "frmMain"
- Add textbox objects on form "frmAdd":
- "txtID" for ID
- "txtPW" for password
- "txtFName" for first name
- "txtLName" for last name
- Others as you see a need
- Add command button objects on form "frmAdd":
- Add a data object "dtaMember" to form "frmAdd", connect the databasename to "member97.mdb" & recordset to "member"
- Pseudocode for form "frmAdd" control button object "cmdClose":
show the form "frmMain"
hide the form "frmAdd"
- Pseudocode for form "frmAdd" control butotn object "cmdAdd:"
use a yes/no message box to confirm that the user really wants to add the data
if yes
add new recordset to dtamember
set fields(1) of recordset of dtamember to txtID.text
set fields(2) of recordset of dtamember to txtPW.text
set fields(3) of recordset of dtamember to txtFName.text
set fields(4) of recordset of dtamember to txtLName.text
update the recordset of dtamember
display that the data was added
clear txtID
clear txtPW
clear txtFName
clear txtLName
set the focus to txtID
else
display that the data was NOT added
end if
- Test by adding several new records using "frmAdd" then go back to "frmMember" & see if the newly added records display
- Consider a way to ensure that the password is correct
|
| 39 |
01/16/08 |
|
Wednesday - Career & SQL & "vbMembers" |
|
- Classroom Discussion -
- Career - bls.gov/oco - Occupational Outlook Handbook
- SQL - sqlCourse.com - UPDATE
- VB6 Tutorial - profsr.com - working with a database
- VB6 Tutorial - woodger.ca - sample vb code
- Lab Assignment -
- Career - Work on your document "What I Want to Be"
- Modify "vbMembers" to include a form to update existing members:
Concept:
- The user will use the display form "frmMember" to browse to the record that needs to be changed
- Textbox objects that display values on "frmMember" are locked & the values can't be changed
- The user will click a command button object "Update" to open a new form "frmUpdate"
- The form "frmUpdate" will display the existing values in textbox objects that are not locked & can be changed
- The textbox objects are NOT connected to the databasesource & databasefield
- The form "frmUpdate" will use a command button object that will change (update) the values in the fields in the databaes using an SQL command
- Member ID CANNOT be changed
- The change will automatically go back to the display form "frmMember" so the user can validate that the values have been changed
Design the form & write the code:
- Open the visual basic project
- Modify the existing control panel form & remove the "cmdUpdate" & "cmdDelete" command button objects
- Modify the existing display form "frmMember" & add a command button object "cmdUpdate"
- Pseudocode for "cmdUpdate" on form "frmMember":
show the update form
unload me
- Create a new form "frmUpdate"
- Add a data object "dtaMember", databasename "member97.mdb", recordsource "member"
- Add textbox objects & labels for database fields (txtPW, txtFN, txtLN, ...) (do NOT connect the textboxes to the datasource or datafield
- Add 1 additional textbox object for memberkey that will used but not displayed or updated (txtKey)
- Add command button objects for "cmdUpdate" & "cmdClose"
- Pseudocode for "cmdClose"
show the member form ' since member shows update, update should return to member
unload me
- Text moving between the member & update forms
- When the update form loads, populate update form textboxes with values from the member form using the syntax: formName.objectName.text
- Pseudocode for "form_Load" on the update form:
set the text property of "txtKey" = the value in the text property of "txtMemberKey" from the member form
set the text property of "txtPW" = the value in the text property of "txtPW" from the member form
set the text property of "txtFN" = the value in the text property of "txtFName" from the member form
set the text property of "txtLN" = the value in the text property of "txtLName" from the member form
- Pseudocode for "cmdUpdate" on the update form:
use a yes/no message box to confirm that the user really wants to update the data
if yes
find the first recordset in dtaMember where "key = " txtKey.text
edit the recordset of dtamember
set fields("pw") of recordset of dtamember to txtPW.text
set fields("fName") of recordset of dtamember to txtFN.text
set fields("lName") of recordset of dtamember to txtLN.text
update the recordset of dtamember
display that the data was added
call the sub-routine "cmdClose_Click" to show the member form & unload me
else
display that the data was NOT updated
end if
- Test, choose a record to change, update the values, check that the values were updated
- Consider a way that when update form returns to member form, the record that was just updated is displayed instead of the first record
|
| 40 |
01/17/08 |
|
Thursday - Math & SQL & "vbMembers" |
|
- Classroom Discussion -
- SQL - sqlCourse.com - DELETE FROM
- VB6 Tutorial - profsr.com - working with a database
- VB6 Tutorial - woodger.ca - sample vb code
- Math with Ms Verde - wikipedia.org - matrix math, part II
- Lab Assignment -
- Modify "vbMembers" to include a form to delete members:
Concept:
- Allow the user to delete the current in the member display form
- Ask the user "Are you really sure?"
Process:
- Open VB6 program "cbMember"
- Open the "member" form
- Add a command button object "cmdDelete"
- Pseudocode for "cmdDelete":
if the recordcount of the recordset in dtaMember <> 0 then
use a yes/no message box to confirm that the user really wants to delete the record FOREVER!!!
if yes
delete the recordset of dtaMember
display a message "Record Deleted"
else
display a message "Record NOT Deleted"
end if
if the recordcount of the recordset of dtaMember = 0 then
move to the next recordset of dtaMember
display a message "There are no more records"
disable the cmdDelete command button
else
move to the next recordset of dtaMember
if end of file for recordset of dtaMember then
move to the last recordset in dtaMember
end if
end if
else
display a message "There are no more records"
disable the cmdDelete command button
end if
|
| 41 |
01/18/08 |
|
Friday - SkillsUSA & SQL Quiz & "vbCypher" |
|
- Classroom Discussion -
- SkillsUSA - nj-skillsUSA.org - Regional & State contests on Feb 2nd at the Brick Center
- Ocean County SkillsUSA Open House & Contests, Saturday, 02/02/08, 9am-1pm, Brick Center, 350 Chambers Bridge Road, Brick, NJ 08723, 732.920.0050
- OCVTS Open House, 02/07/08, 7pm-8:30pm, Toms River Center, 1299 Old Freehold Road, Toms River, NJ 08753, 732.473.3100
- Definition - cypher - A cryptographic system in which units of plain text of regular length, usually letters, are arbitrarily transposed or substituted according to a predetermined code
- Definition - cryptography - the science or study of the techniques of secret writing, esp. code and cipher systems, methods, and the like
- Definition -
|