Marking Period 1

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
09/03/07 Monday - Labor Day Holiday
Extra Credit -- Send your e-mail address to Mr. Clarke before school starts asking for Extra Credit & receive Extra Credit!!!
Send your parent's/guardian's e-mail address e-mail to Mr. Clarke before school starts and receive Extra Extra Credit!!!
09/04/07 Tuesday - OCVTS School Closed - Teacher's Preparation Day
1 09/05/07 Wednesday - Classroom Rules - Welcome to Computer Science
  1. Classroom Discussion -
    1. Distribute student "css##" ID numbers & passwords
    2. Test ID numbers & passwords by logging on
    3. Setup printers for use, instructions in "Lab Assignment" below
    4. Discuss School Rules using Microsoft PowerPoint presentation, click link
  2. Lab Assignment -
    1. Review classroom rules
    2. Forms to complete & return to teacher:
      1. Message from Principal - student signature
      2. Emergency Card - student fills out
      3. Computer Contract - student & parent/guardian signatures
      4. Social Security Number - student signature
      5. Consent Form - parent/guardian signature
    3. Research "History of Computing" online, take notes, bookmark the best sites, & be prepared to participate in classroom discussion tomorrow
    4. Contact information - send "mclarke@mail.ocvts.org" an e-mail from your e-mail address
    5. AIM contact name - "compSciClarke"
    6. Microsoft IM contact - "mrclarke@hotmail.com"
    7. Guidelines to Add New Printer:
      1. Click "Start"
      2. Click "Printers & other hardware"
      3. Identify any existing printers (HP LJ5) & (Tektronix)
      4. If they both exist, simply close the printers window, otherwise, continue:
      5. Click "Add a Printer" to open the Printer Wizard
      6. Read the Welcome Message & Click "Next"
      7. Our printers are Network Printers, click that button, & click "Next"
      8. Search for printers
      9. Click "HP LJ5" & click "Next"
      10. Click "Finish" to add the printer
      Repeat for the "Tektronix" printer

2 09/06/07 Thursday - Classroom Rules, Computer IDs, & History of Computing Science
  1. Classroom Discussion -
    1. Distribute student "css##" ID numbers & passwords
    2. Test ID numbers & passwords by logging on
    3. Setup printers for use, instructions in "Lab Assignment" below
    4. Discuss School Rules using Microsoft PowerPoint presentation, click link
    5. Discuss The History of Computing Science
  2. Lab Assignment -
    1. Review classroom rules
    2. Forms to complete & return to teacher:
      1. Message from Principal - student signature
      2. Emergency Card - student fills out
      3. Computer Contract - student & parent/guardian signatures
      4. Social Security Number - student signature
      5. Consent Form - parent/guardian signature
    3. Research "History of Software" online, take notes, bookmark the best sites, & be prepared to participate in classroom discussion tomorrow
    4. Contact information - send "mclarke@mail.ocvts.org" an e-mail from your e-mail address
    5. AIM contact name - "compSciClarke"
    6. Microsoft IM contact - "mrclarke@hotmail.com"

3 09/07/07 Friday - Classroom Rules, History of Software, Intro to Visual Basic, "vbHelloWorld"
  1. Classroom Discussion -
    1. Distribute student "css##" ID numbers & passwords
    2. Test ID numbers & passwords by logging on
    3. Setup printers for use, instructions in "Lab Assignment" below
    4. Discuss School Rules using Microsoft PowerPoint presentation, click link
    5. Discuss History of Software:
      • Computer System:
        • Hardware: System Box, Keyboard, Mouse, Monitor, Printer, etc.
        • Software: Operating System & Applications Software
        • People: Requried to input data & receive output information
        • Data: Facts & Figures
      • Computer System does four things:
        • Input: Information put into a communications system for transmission or into a computer system for processing: Keyboard & Mouse
        • Process: A part of a running software program or other computing operation that does a single task
        • Storage: The part of a computer that stores information for subsequent use or retrieval: Hard Disk, Floppy Disk, Memory Stick, Optical Disk
        • Output: The information produced by a program or process from a specific input: Monitor, Printer
      • Two types of software:
        • Operating Systems: Software designed to control the hardware of a specific data-processing system in order to allow users & application programs to make use of it
        • Applications Software: a program that gives a computer instructions that provide the user with tools to accomplish a task
      • Operating Systems:
        • MS-DOS: Microsoft Disk Operating System
        • Windows: A rectangular area on the screen that displays its own file or message independently of the other areas of the screen
        • Apple OS: Apple Computer Corporation Operating System
        • Unix: An interactive time-sharing operating system invented in 1969
        • Linux: An implementation of the Unix kernel originally written from scratch with no proprietary code
      • Applications Software:
        • Word Processing: The creation, input, editing, & production of documents & texts by means of computer systems
        • Spreadsheet: An accounting or bookkeeping program that displays data in rows & columns on a screen
        • Database: Programs to ease the collection of data arranged for ease & speed of search & retrieval
        • Presentation: Software program for creating graphic presentations with visual aids, handouts, slides, etc
        • Entertainment: Software that amuses, pleases, or diverts
        • Education: Software whereby knowledge or skill is obtained or developed by a learning process
        • Communications: Software for sending & receiving messages
      • Software Developers use Programming Languages to create both Operating Systems & Applications Software:
        • Source Code: Before interpreting or compiling: Code written by a programmer in a high-level language & readable by people but not computers. Source code must be converted to object code or machine language before a computer can read or execute the program
        • Machine Code: After interpreting or compiling: The code produced by a compiler from the source code, usually in the form of machine language that a computer can execute directly
      • Two main types of programming languages:
        • Interpreter: A program that translates an instruction into a machine language & executes it before proceeding to the next instruction
        • Compiler: A program that translates another program written in a high-level language into machine language so that it can be executed
      • Basic is an interpreted language. Visual Basic may also be compiled into executable code.
    6. The History of Programming
    7. History's Worst Software Bugs
    8. Introduction to Visual Basic:
      • Different ways to open the VB IDE in Windows
      • VB IDE - Integrated Development Environment
      • Menu Options & Features
      • Toolbox, Project, & Properties Windows
    9. Online VB6 Text: Sams Teach Yourself Visual Basic 6 in 24 Hours
    10. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 1 - Visual Basic at Work
  2. Lab Assignment -
    1. Review classroom rules
    2. Find your network home drive:
      • Open Windows Explorer - click [start], click [my computer]
      • Navigate to your home drive - letter "H:"
      • Review the folders available
      • Let me know if you have any problems
    3. Create a Visual Basic program "HelloWorld": helloWorldDemo
      1. Save your work to your "My Documents" folder
        • You don't have "write" permissions to the VB6 folder
        • You share the PC with another student
        • You won't "overwrite" another student's work
        • Another student won't "overwrite" your work
      2. Make a new folder in your "My Documents" called "Hello World" & save all your "Hello World" work there
      3. Open VB & create a new, standard.exe
      4. Save the form as "frmHelloWorld.frm"
      5. Save the project as "vbHelloWorld.vbp", both into your "My Documents/vb" folder
      6. Name the Form "frmHelloWorld"
      7. Change the Form caption to "My First VB Program"
      8. Change the Form background color as desired
      9. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      10. Test & debug your program (call me for assistance)
      11. Add a Textbox object & name it "txtHelloWorld"
      12. Change the Textbox text property to "Hello World!"
      13. Change the Textbox font sizes as desired
      14. Change the Textbox size as necessary
      15. Change the Textbox background & foreground colors
      16. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      17. Test & debug your program (call me for assistance)
      18. Add a Label object & name it "lblHelloWorld"
      19. Change the Label caption property to "Hello World!"
      20. Change the Label font sizes as desired
      21. Change the Label size as necessary
      22. Change the Label background & foreground colors
      23. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      24. Test & debug your program (call me for assistance)
      25. Add a Command Button object & name it "cmdHelloWorld"
      26. Change the Command Button caption property to "Hello World!"
      27. Change the Command Button font sizes as desired
      28. Change the Command Button size as necessary
      29. Change the Command Button background & foreground colors (is there a foreground color?)
      30. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      31. Test & debug your program (call me for assistance)
    4. To open an existing VB6 project:
      • Open Windows Explorer
      • Navigate to the correct folder
      • Double click on the ".vbp" file
    5. Research "Word Processing" & "Microsoft Word Tutorial" online, take notes, bookmark the best sites, & be prepared to participate in classroom discussion Monday
    6. Forms to complete & return to teacher:
      1. Message from Principal - student signature
      2. Emergency Card - student fills out
      3. Computer Contract - student & parent/guardian signatures
      4. Social Security Number - student signature
      5. Consent Form - parent/guardian signature
    7. Contact information - send "mclarke@mail.ocvts.org" an e-mail from your e-mail address
    8. AIM contact name - "compSciClarke"
    9. Microsoft IM contact - "mrclarke@hotmail.com"

4 09/10/07 Monday - Visual Basic Label, Textbox, & CommandButton objects, "vbAge"
  1. Classroom Discussion -
    1. Some Definitions:
      • Program: A sequence of instructions that a computer can interpret & execute
      • Programming: Creating a sequence of instructions to enable the computer to do something
      • Systems Analysis: The study of an activity or procedure to determine the desired end & the most efficient method of obtaining this end
      • Writing a good program is the act of taking a large problem & continually splitting it into smaller & smaller sub-problems until you reach a point where each sub-problem requires one solution & is easy to program
      • Three types of sub-programs:
        • sub-procedures
        • sub-routines
        • functions
      • Syntax: The rules governing the formation of statements in a programming language. Every programming language has similar, but different, syntax rules
      • Computer Error: the occurrence of an incorrect result produced by a computer
      • Three types of computer error:
        • Syntax Error: an error in a program due to a code that does not conform to order expected by the programming language, detected during compiling or interpreting
        • Run-Time Error: an error in arithmetic during computer run that, detected at run time
        • Logic Error: an error the programmer makes during design of the program, the program compiles & runs but gives incorrect results
      • Computer User: A person who uses computers for work or entertainment or communication or business
        • Most users lack full understanding of how to truly use a computer
        • Some users are actually afraid of the computer
        • All users are either slow to learn or understand; obtuse or tend to make poor decisions or careless mistakes
        • Therefore, it is up to the programmer to make the program as "idiot-proof" as humanly possible
        • Users are [insert appropriate word here]!!!
      • Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 2 - Analyzing Visual Basic Programs
  2. Lab Assignment -
    1. School Rules Quiz
      • Click the link & follow the instructions
      • Principal Coleman requires that each student score 100% on this quiz
      • You will continue to take the quiz each day until you score 100%
    2. Create a Visual Basic program "Age": ageDemo
      1. Open VB & create a new, standard.exe
      2. Save the form as "frmAge.frm" & save the project as "vbAge.vbp", both into your "My Documents/vb" folder
      3. Name the form "frmAge", change the caption to "Given your age, calculate your year of birth"
      4. Add a Label object, name it "lblTitle", change the caption property to "Instructions: Enter your age in the age box & click GO to calculate your year of birth"
      5. Add a Label object, name it "lblAge", change the caption property to "Your Current Age", this will identify what the user is to enter into the textbox
      6. Add a Label object, name it "lblYear", change the caption property to "Year of Birth", this will identify the answer
      7. Add a Textbox object, name it "txtAge", change the text property to "", this is where the user will enter his age
      8. Add a Label object, name it "lblAnswer", change the caption property to "", this will hold the answer
      9. Add a CommandButton object, name it "cmdCalculate", change the caption property to "&Calculate", change the default property to "True"
      10. Add a CommandButton object, name it "cmdExit", change the caption property to "e&Xit", change the cancel property to "True"
      11. Double-click the CommandButton object "cmdExit" & enter "End". This program instruction, executed through a user click event, will cause the program to stop running
      12. Double-click the CommandButton object "cmdCalculate" & enter "lblAnswer.Caption = 2007 - txtAge.Text". This program instruction, executed through a user click event, will change the Textbox object "txtYear" "Text" property to be the result of the process of subtracting the user's age, found in the Textbox object "txtAge" "Text" property, from the year 2007
      13. Center the instructions across the top of the form
      14. Change font sizes as desired
      15. Change background & foreground colors
      16. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      17. Test & debug your program (call me for assistance)
      18. Extra Credit Idea - Figure out how to add objects to allow the user to enter his year of birth and display his age

5 09/11/07 Tuesday - Putting Code into Visual Basic, Image Object, "vbTrafficLight"
  1. Classroom Discussion -
    1. Discuss the Image object & it's properties
    2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 18 - The Graphic Image Controls
  2. Lab Assignment -
    1. School Rules Quiz
      • Click the link & follow the instructions
      • Principal Coleman requires that each student score 100% on this quiz
      • You will continue to take the quiz each day until you score 100%
    2. Create a simple VB program to display a traffic light image. Provide the user with three command buttons "Stop", "Caution", & "Go". These buttons will control which of three images will display in the form on the screen: lightDemo
      1. Use Microsoft Paint to create three image files called "Stop.bmp", Caution.bmp", "Go.bmp"
      2. Alternatively, you may locate three images I found on the Internet: Look on the "Q:" drive for files named "traffic_light_green.jpg", "traffic_light_red.jpg", & "traffic_light_yellow.jpg"
      3. Save these to your "My Documents/vb" folder
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Save the form & project to your "My Documents/vb" in a new folder called "light" as "light.frm" & "light.vbp"
      3. VB will NOT correctly locate any images until you close & reopen it:
        1. Save
        2. Close Visual Basic
        3. Use Windows Explorer (My Computer or My Documents) to navigate to your "My Documents/vb/light/" folder
        4. The images & VB files should all be stored in the same folder
        5. Open VB by double-clicking on the "light.vbp" file
      4. Name the form "frmLight"
      5. Add an image object to the center of your form
      6. Name the image object "imgLight"
      7. Change the size to make it twice as high as it is wide
      8. Add a command button.
      9. Name the command button "cmdRed"
      10. Change the caption to read "Red"
      11. Double-Click the "cmdRed" command button to open the code window
      12. Add this line: "imgLight.Picture = LoadPicture("traffic_light_red.jpg")"
      13. Save all your work & images in the same folder
      14. Add another command button for "Yellow", change the name, change the caption, add the code
      15. Add another command button for "Green", change the name, change the caption, add the code
      16. Add a label named "lblInstructions" with a caption instructing the user to press the buttons to see the light change
      17. Add another command button for "Exit"
      18. Name the Command Button "cmdExit"
      19. Change the Command Button caption to "e&Xit"
      20. Change the Cancel property to "True" for the excape key
      21. Double-Click the Command Button to open the Code Window
      22. Add "End" after the subroutine title cmdExit_Click() line & before the End Sub line
      23. Use menu bar options "Run", "Start" to test your program
      24. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      25. Test & debug your program (call me for assistance)
      26. Extra Credit Idea - Figure out how to display the light image "traffic_light_all.jpg" when the program starts before the user presses any buttons
      27. Extra Credit Idea - Figure out how add control objects to allow the user to clear or remove the traffic light totally from the screen so the user sees nothing

6 09/12/07 Wednesday - Visual Basic Practice with Image, Label, Textbox, & Command Button Objects, "vbImageDisplayer", "vbTextDemo", "vbRailDemo"
  1. Classroom Discussion -
    1. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 3 - Controls and Properties
  2. Lab Assignment -
    1. School Rules Quiz
      • Click the link & follow the instructions
      • Principal Coleman requires that each student score 100% on this quiz
      • Students who have not achieved 100% will take the quiz again
    2. Create a simple VB program to display images two ways, normal & stretched: imageDisplayerDemo
      1. Windows contains a large number of bitmap & other graphics files
      2. Use a text box into which the user enters the name of a graphical image
      3. When the user clicks a command button, display the selected graphics file in two Image objects
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Make a folder "imageDisplayer"
      3. Save as "frmImageDisplayer.frm" & "vbImageDisplayer.vbp" to your "My Documents/VB/imageDisplayer" folder
      4. Rename the Form to "frmDisplayer"
      5. Resize the Form to about twice as wide as it is high
      6. Change the caption property to read "John Doe's Famous Image Displayer", but use your name
      7. Add a Label object named "lblImageFileName" & change the caption property to something like "Enter File Name:"
      8. Add a Textbox object named "txtImageFileName" & change the text property to be blank
      9. Add two Image objects, the first on the left, the second on the right
      10. Name the first Image object "imgLeft" & the second "imgRight"
      11. Make both Image objects the same size & large
      12. Change the stretch property for imgRight to "True"
      13. Add a Command Button object named "cmdDisplay" & change the caption property to "&Display"
      14. Set this Command Button to run when the "Enter" key is pressed
      15. Double click the "cmdDisplay" command button & add these lines to the code window:
        "imgLeft.Picture = LoadPicture(txtImageFileName.Text)"
        "imgRight.Picture = LoadPicture(txtImageFileName.Text)"
        
        Your names must match my names for this code to work
      16. Add a Command Button object named "cmdExit" & change the caption property to "e&Xxit"
      17. Set this Command Button object to run when the "Escape" key is pressed
      18. Write the code for the "Exit" button
      19. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      20. Test & debug your program (call me for assistance)
      21. SAVE FREQUENTLY
      22. Extra Credit Figure out how to make the text window a dropdown menu with all the images in a folder listed
    3. Create a VB program to demonstrate how text can be moved to different control instances on a form: textDemo
      1. When the user clicks on button 1, copy the caption from button 1 to the caption of label 1 & the text of text box 1
      2. When the user clicks on button 2, copy the caption from label 2 to the text of text box 2
      3. When the user clicks on button 3, copy the text from text box 3 to the caption of label 3
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Make a folder "textDemo"
      3. Save to your "My Documents/vb/textDemo" folder as "frmTextDemo.frm" & "vbTextDemo.vbp"
      4. Create a form with three labels, three text boxes, & three command buttons
      5. Name the form "frmTextDemo"
      6. Arrange the objects so they look good
      7. Name the form "frmTextDemo" & change the caption to something appropriate
      8. Name the first text box "txt1" & change the text to read "Text Box 1"
      9. Name the second text box "txt2" & change the text to read "Text Box 2"
      10. Name the third text box "txt3" & change the text to read "Text Box 3"
      11. Name the first label "lbl1" & change the caption to read "Label 1"
      12. Name the second label "lbl2" & change the caption to read "Label 2"
      13. Name the third label "lbl3" & change the caption to read "Label 3"
      14. Name the first command button "cmd1" & change the caption to read "Button 1"
      15. Name the second command button "cmd2" & change the caption to read "Button 2"
      16. Name the third command button "cmd3" & change the caption to read "Button 3"
      17. Double click the first command button & add this code:
        lbl1.Caption = cmd1.Caption
        txt1.Text = cmd1.Caption
        
      18. Double click the second command button & add this code:
        txt2.Text = lbl2.Caption
        
      19. Double click the third command button & add this code:
        lbl3.Caption = txt3.Text
        
      20. Add an Exit command button, change the name & caption. Use the "&" to make a hotkey. Make it so the "escape" key will activate the Exit event. Double click the Exit command button & add the code to "End" the program
      21. Use the techniques you learned over the past couple of days
      22. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      23. Test & debug your program (call me for assistance)
      24. Extra Credit What would happen if the user changed the text in text box 2 & then clicked on command button 2? Test your thesis
    4. Create a VB program to simulate a railroad train schedule: trainDemo
      1. Design a form that would allow the user to choose between displaying "Morning", "Afternoon", or "Evening" train schedules
      2. The information to be displayed would be "Scheduled Departure Time", "Track Number", & "Train Status"
      3. Leave room to display up to five trains
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Create a folder "railDemo"
      3. Save to your "My Documents/vb/railDemo" folder as "frmRailDemo.frm" & "vbRailDemo.vbp"
      4. Name the form "frmRailDemo"
      5. Add a Command Button object for "Exit", write the code, make the "Escape" key work
      6. Math time -- you need three labels (Time, Track, & Status) for each of five trains:
        3 x 5 = 15
        
        so, you need to add 15 Label objects. Be sure to name each one separately, something like:
        lblTime1, lblTrack1, lblStatus1
        lblTime2, lblTrack2, lblStatus2
        lblTime3, lblTrack3, lblStatus3
        lblTime4, lblTrack4, lblStatus4
        lblTime5, lblTrack5, lblStatus5
        
        Arrange them on the form so they look good.
      7. Make the "Border Style" property for all Label objects "Fixed Single" so that they look like unchangable Textbox objects
      8. Write the code for the "Morning" Command Button object:
        lblTime1.Caption = "7:00 a.m."
        lblTrack1.Caption = "Track 2"
        lblStatus1.Caption = "On Time"
        lblTime2.Caption = "7:20 a.m."
        lblTrack2.Caption = "Track 1"
        lblStatus2.Caption = "On Time"
        lblTime3.Caption = "8:00 a.m."
        lblTrack3.Caption = "Track 3"
        lblStatus3.Caption = "Delayed"
        lblTime4.Caption = "8:30 a.m."
        lblTrack4.Caption = "Track 1"
        lblStatus4.Caption = "On Time"
        lblTime5.Caption = "9:00 a.m."
        lblTrack5.Caption = "Track 2"
        lblStatus5.Caption = "On Time"
        
        Remember that your program will only work with my code if you use the same object names that I have
      9. Write similar code for the "Afternoon" & "Evening" Command Button objects
      10. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      11. Test & debug your program (call me for assistance)
      12. Extra Credit - Make one of the "Afternoon" blank & have only four trains
    5. Your "H:" drives should now work. You may only access your own "H:" drive. I can access all "H:" drives. Copy your work there so I may see it:
      1. Open "Windows Explorer" or "My Documents" & navigate to "H:"
      2. View the folders I have created:
        • C++ - for the C++ programming language projects we will create
        • Grades - for me to place an Excel spreadsheet with your grades, assignments completed, & assignments due
        • Java - for the Java programming language projects we will create
        • OtherAssignments - for other assignments
        • toBeGraded - for any project that you wish me to grade - NOTE: I will empty this folder after I grade your work
        • VB - for the Visual Basic programming language projects we will create
      3.  Every day, after your work is complete, copy the most recent folders & files to the proper folder on the "H:" drive
      4.  If you want me to grade an assignments, also copy it to "toBeGraded"

7 09/13/07 Thursday - OCVTS School Closed - Rosh Hashanah
  1. Classroom Discussion -
    1. Parental/Guardian signed forms due on Monday: no computer contract = no computer use
    2. Discuss Chapter 5 from Free-Ed.Net on Visual Basic, "Lesson 5 - Putting Code into VB"
    3. Discuss:
      • Standard data types - number, text, date, boolean
      • VB data types - boolean, byte, currency, date, decimal, double, integer, long, object, single, string, variant
      • Declare variables in VB - Dim VarName As DataType
      • Dim statement locations - Global vs. local
      • How to assign data to variables - VarName = Expression
      • Alternate - Dim VarName As DataType : VarName = Expression
      • Math operators - Add "+", Subtract "-", Multiply "*", Divide "/", Power "^", Concatenate "&"
      • Why data type mixups can occur:
        Dim Result As Integer : Result = 1 / 2
        Dim GrossPay As Single : GrossPay = 40 * 5.50
        
  2. Lab Assignment -
    1. School Rules Quiz
      • Click the link & follow the instructions
      • Principal Coleman requires that each student score 100% on this quiz
      • You will continue to take the quiz each day until you score 100%
    2. Create a simple VB program to test data type mixups: variableDemo
      1. Assign a real number to an integer variable & display the integer variable in a label caption
      2. Assign an integer number to a real variable & display the integer variable in a label caption
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Save the form & project to your "My Documents/vb" folder as "frmVariableDemo.frm" & "vbVariableDemo"
      3. Name the form
      4. Add code for two global variables at the top of the code window:
        Dim sngNum As Single
        Dim intNum As Integer
        
      5. Add a command button & code & "cancel" for exit
      6. Add a text box for input "txtInput"
      7. Add a label for output "lblOutput"
      8. Add a command button & code for RealInteger
        intNum = txtInput.Text
        lblOutput.Caption = intNum
        
      9. Test with a real number, like "2.5". Is the output real or integer?
      10. Add a command button & code for IntegerReal
        sngNum = txtInput.Text
        lblOutput.Caption = sngNum
        
      11. Test with an integer number, like "7". Is the output real or integer?
      12. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      13. Test & debug your program (call me for assistance)
      14. Extra Credit What happens if you enter a word or a date?
    3. Create a VB program to perform common distance conversions: distanceDemo
      1. Inches to Centimeters
      2. Centimeters to Inches
      3. Feet to Meters
      4. Meters to Feet
      5. Miles to Kilometers
      6. Kilometers to Miles
      For your conversion numbers:
      1. 1 inch = 2.54 centimeters
      2. 1 centimeter = 0.4 inches
      3. 1 foot = 0.305 meters
      4. 1 meter = 3.28 feet
      5. 1 mile = 1.6 kilometers
      6. 1 kilometer = 0.625 miles
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Save the form & project to your "My Documents/vb" folder as "frmDistanceConverter.frm" & "vbDistanceConverter"
      3. Add a textbox for input
      4. Add a label for output
      5. Add instructions to the user
      6. Add & name a command button for each conversion
      7. Here's the general steps for each button:
        1. Assign the input text into a variable
        2. Calculate the answer
        3. Assign the answer to the output label caption
        4. For example, Inches to Centimeters, if you use these variable names:
          dblInput = txtInput.text
          dblOutput = dblInput * 2.54
          lblOutput.caption = dblOutput
          
      8. Add a command button & code & "cancel" for exit
      9. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      10. Test & debug your program (call me for assistance). Use numbers that are easy to confirm. For example:
        10 inches = 25.4 centimeter
        10 centimeters = 4.0 inches
        
      11. Extra Credit Add some other useful distance conversions

8 09/14/07 Friday - "vbTemperatureConverter"
  1. Classroom Discussion -
    1. Parental/Guardian signed forms due on Monday: no computer contract = no computer use
    2. Next week my AM class is assigned the pledge & morning announcements - any volunteers?
    3. Discuss:
      • Global Variables - Declared at the top of the program, usable by any part of the program
      • Local Variables - Declared inside a sub-routine, usable by ONLY that sub-routine
      • OPTION EXPLICIT - Written as the first line of the program, requires the programmer to correctly declare & spell any & all variables -- a great programming technique
      • Variable Naming Convention:
        • Must start with a letter
        • May contain letters & numbers
        • May NOT contain special characters
        • May contain underscore "_"
        • Use the 3-letter prefix patterns:
          • int for integer
          • sng for single
          • dbl for double
          • str for string
          • bln for boolean
          • dtm for date
        • Should make sense to another programmer:
          • use intAge instead of a
          • use sngPayRate instead of pr
          • use dblLightSpeed instead of ls
          • use strFirstName instead of fn
          • use blnIsActiveMember instead of iam
          • use dtmBirthDate instead of bd
      • Variable Declaration Syntax - "Dim VarName As DataType" - Examples:
        • Dim intAge As Integer
        • Dim sngPayRate As Single
        • Dim dblLightSpeed As Double
        • Dim strFirstName As String
        • Dim blnIsActiveMember As Boolean
        • Dim dtmBirthDate As Date
    4. Review before Quiz - NOW is the time to ask your questions
  2. Lab Assignment -
    1. Create a VB program to perform common temperature conversions: temperatureDemo
      1. Fahrenheight to Centigrade
      2. Centigrade to Fahrenheight
      For your conversion numbers:
      1. Fahrenheight temperature is 9/5ths of the Centigrade temperature plus 32 (do the plus 32 last)
      2. Centigrade temperature is 5/9ths of the Fahrenheight temperature minus 32 (do the minus 32 first)
      3. (If you can't figure out the conversion, watch the board, I'll do some examples)
      Some ideas:
      1. Open VB & create a new, standard.exe
      2. Save the form & project to your "My Documents/vb" folder as "frmTemperatureConverter.frm" & "vbTemperatureConverter"
      3. Add a textbox for input
      4. Add a label for output
      5. Add instructions to the user
      6. Add variables at the top of the program
      7. Add & name a command button for each conversion
      8. Here's the general steps for each button:
        1. Assign the input text into a properly named variable of the proper data type
        2. Calculate the answer & assign the answer to the output label caption
      9. Add a command button & code & "cancel" for exit
      10. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      11. Test & debug your program (call me for assistance). Use numbers that are easy to confirm. For example:
        68o F = 20o C & 20o C = 68o F
        77o F = 25o C & 25o C = 77o F
        86o F = 30o C & 30o C = 86o F
      12. Extra Credit Add some other useful temperature conversions, like Kelvin
    2. Complete any unfinished labs

9 09/17/07 Monday - Pledge & Announcements, Visual Basic Quiz 1, VB Input/Output, "vbTemperatureConverter2"
  1. Classroom Discussion -
    1. One AM student needed as volunteer to assist with the morning pledge & announcements
    2. Parental/Guardian signed forms due TODAY: no computer contract = no computer use
    3. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 4 - Examining Labels, Buttons, and Text Boxes
    4. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 5 - Putting Code into Visual Basic
    5. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 6 - Message and Input Boxes
    6. VB Code Comments or Remarks - Remarks help both you & other programmers who might modify & update your Visual Basic applications in the future. Remarks offer descriptive messages that explain in English (or whatever language you prefer) what's going on in the program's event procedures:
      REM This is one example of a remark
      ' This an example of a comment
      Dim intAge As Integer REM This is a third example of a remark
      intAge = 17 ' & this is a fourth example of a comment
      
      Programmers often add remarks to their programs for the following purposes:
      • To state the programmer's name & the date that the program was written
      • To describe in the general section the overall goal of the program (the general section appears before all of a procedure's procedures & is the location Hour 5, "Putting Code into Visual Basic," described when it talked about declaring global variables)
      • To describe at the top of every procedure the overall goal of that procedure
      • To explain tricky or difficult statements so that others who modify the program later can understand the lines of code without having to decipher cryptic code
    7. VB Output - MsgBox() - Instructions or output to the user, returns a number that tells which button the user has clicked:
      • Syntax:
        intVariable = MsgBox( strMsg [, [intType] [, strTitle]])
        
      • strMsg - the content of the message to the user
      • intType - optional buttons or icons to be displayed
      • strTitle - optional message box title bar text
    8. Do lab 1
    9. VB Input - InputBox - Another way to get input, returns a string value that holds the answer typed by the user:
      • Syntax:
        strVariable = InputBox( strPrompt [, [strTitle] [, strDefault] [, intXpos, intYpos]]])
        
      • strPrompt - the content of the message to the user
      • strTitle - optional message box title bar text
      • strDefault - optional default input so that the user can just hit [OKAY]
      • intXpos - number of twips from the left side
      • intYpos - number of twips from the top
    10. Do lab 2
    11. Lab Assignment -
      1. Visual Basic Quiz 1
      2. Modify your "vbTemperatureConverter.vbp" program to use a MsgBox: temperatureDemo2
        1. Use a MsgBox to tell the user goodbye on exit
        Some ideas:
        1. Use windows explorer & navigate to where your program "vbTemperatureConverter.vbp" is saved & open it
        2. Add a new global variable at the top:
          Dim intMsgRes As Integer
          
        3. View the form & double click command button exit
        4. Add VB code for a MsgBox before the "End" command:
          intMsgRes = MsgBox("Goodbye")
          
        5. Test it to see how it works
        6. Modify the VB msgbox code to see how some of the icons & buttons & title work:
          intMsgRes = MsgBox("Goodbye", vbInformation, "Exit Message")
          or
          intMsgRes = MsgBox("Goodbye", vbOKOnly, "Son of a Gun")
          or
          intMsgRes = MsgBox("Goodbye", vbExclamation + vbonly, "This is Fantastic")
          or
          intMsgRes = MsgBox("Goodbye", vbQuestion + vbYesNo, "Or maybe Tanfastic")
          or
          intMsgRes = MsgBox("Goodbye", vbCritical + vbAbortRetryIgnore, "I'm gettin' this")
          
      3. Modify your "vbTemperatureConverter.vbp" program to use an InputBox: temperatureDemo2
        1. Use an InputBox to allow the user to confirm the temperature
        2. Echo the user input from the textbox as the default in an InputBox & ask the user it this is accurate
        Some ideas:
        1. View the form & double click command button FahrToCent
        2. Modify VB code for an InputBox after assigning the textbox to a variable but before processing the variable:
          sngFahr = txtInput.Text
          sngFahr = InputBox("Convert this temperature?", , sngFahr) ' confirm temperature to be converted
          txtInput.Text = sngFahr ' put the inputbox temperature into the textbox in case the user has changed it
          sngCent = (sngFahr - 32) * 5 / 9
          lblOutput.Caption = sngCent
          
        3. Test it to see how it works
        4. Modify the VB msgbox code to see how the title works:
          sngFahr = InputBox("Convert this temperature?", "Temperature Confirmation, sngFahr)
          
        5. Do similarly for Centigrade to Fahrenheit
        6. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        7. Extra Credit Add a confirm exit MsgBox to all of your VB programs

    10 09/18/07 Tuesday - Pledge &Announcements, VB IF THEN Statement, "vbSalary", "vbGrades"
    1. Classroom Discussion -
      1. One AM student needed as volunteer to assist with the morning pledge & announcements
      2. Parental/Guardian signed forms due: no computer contract = no computer use
      3. Vocabulary:
        • Three types of statements in every programming language:
          1. Sequential - Following of one after another
          2. Decision - The act of reaching a conclusion or making up one's mind
          3. Iteration - To perform again; repeat
        • Algebra - A branch of mathematics in which symbols, usually letters of the alphabet, represent numbers or members of a specified set & are used to represent quantities & to express general relationships that hold for all members of the set
        • George Boole (1815-1864) - British mathematician & logician who developed a calculus of symbolic logic
        • Boolean - Of or relating to a logical combinatorial system treating variables, such as propositions & computer logic elements, through the operators AND, OR, NOT, & XOR
        • Boolean Algebra - An algebra in which elements have one of two values & the algebraic operations defined on the set are logical OR, a type of addition, & logical AND, a type of multiplication
      4. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 7 - Making Decisions
      5. Review Arithmetic Operators & Order of Operations (PEMDAS):
        • ( ) Parenthesis
        • ^ Exponentiation
        • * Multiply
        • / Divide
        • + Add
        • - Subtract
      6. Review String Arithmetic Operator:
        • & Concatenate
      7. Comparison Operators:
        • > Greater Than
        • < Less Than
        • = Equal To
        • >= Greater Than or Equal To
        • <= Less Than or Equal To
        • <> Not Equal To
      8. Comparison Rules:
        • Returns True or False
        • Resulting return may be stored in a Boolean variable
        • Compare only two objects at a time
        • Both sides must be the same data type
        • Do not compare non-integer numbers for equality
        • To compare three or more objects, compare pairs using Boolean operators & Boolean Algebra
      9. Comparison Examples:
        • lblSales.Caption > Goal
        • Pay < 2000.00
        • Age = Limit
        • FirstName >= "Mike"
        • Num <= lblAmt.Caption
        • txtAns.Text <> "Yes"
      10. The VB IF THEN Statement:
        • Allows the computer to make a choice of whether or not to perform a process
        • Syntax:
          If comparisonTest Then
          	' One or more Visual Basic statements
          End If
          
        • IF the comparison returns a True result THEN statements before the END IF are performed
    2. Lab Assignment -
      1. Create a new VB program to process Salary: salaryDemo1
        1. Receive hours worked from the user
        2. Receive pay rate from the user
        3. Calculate & display gross pay
        4. Calculate & display taxes
        5. Calculate & display net pay
        Program Logic:
        1. User will enter hours worked & pay rate, so you need to save this data to variables
        2. Gross pay is calculated as hours worked times pay rate
        3. Taxes is calculated as 20% of gross pay
        4. Net pay is the result of subtracting taxes from gross pay
        Some ideas:
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "frmSalary.frm" & "vbSalary.vbp"
        3. Create variables at the top:
          Option Explicit
          Dim sngHoursWorked As Single
          Dim sngPayRate As Single
          Dim sngGrossPay As Single
          Dim sngTaxes As Single
          Dim sngNetPay As Single
          Dim intMsgRes As Integer
          Dim strResults As String
          
        4. Add a command button to exit, set the cancel property to true so the escape key works, add the code to end
        5. Modify the exit button to use a MsgBox to allow the user to confirm upon exit:
          intMsgRes = MsgBox("Really Exit?", vbQuestion + vbYesNo, "Confirm Exit")
          If intMsgRes = vbYes Then
              End ' exit on user click yes
          End If
          
        6. Add a command button to go, set the default property to true so the enter key works, add the code:
          1. Receive sngHoursWorked & sngPayRate from the user using InputBoxes:
            sngHoursWorked = InputBox("Enter Hours Worked", "Hours Worked", 30)
            sngPayRate = InputBox("Enter Pay Rate", "Pay Rate", 10)
            
          2. Calculate gross pay, taxes, & net pay:
            sngGrossPay = sngHoursWorked * sngPayRate
            sngTaxes = sngGrossPay * .2
            sngNetPay = sngGrossPay - sngTaxes
            
        7. Display results to user using a message box:
          strResults = "Hours Worked: " & sngHoursWorked & vbCrLf
          strResults = strResults & "Pay Rate: " & sngPayRate & vbCrLf
          strResults = strResults & "Gross Pay: " & sngGrossPay & vbCrLf
          strResults = strResults & "Taxes: " & sngTaxes & vbCrLf
          strResults = strResults & "Net Pay: " & sngNetPay
          intMsgRes = MsgBox(strResults, vbOKOnly, "Salary")
          
        8. Test with these numbers. If you enter hours & rate, your resulting gross, taxes, & net should be the same as mine:
          hours rate gross taxes net
          30 10 300 60 240
          40 10 400 80 320
          50 10 500 100 400
        9. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        10. Extra Credit What can you think of to do to make this program better?
      2. Create a new VB program to determine a letter grade given a numberical grade. Consider: gradeDemo1
        1. Read a number grade & display the appropriate letter grade:
          Number Grade Letter Grade
          93-100 A
          85-92 B
          75-84 C
          65-74 D
          0-64 F
        Some ideas:
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "frmGrades.frm" & "vbGrades.vbp"
        3. What variables do you need?
        4. Is the number grade variable integer or single?
        5. What data type is the letter grade variable?
        6. How will you receive your input (number grade)?
        7. How will you code the decision the computer needs to make?
        8. Is the order in which you test number grade important?
        9. How will you display the result to the user?
        10. Test all possibilities: 100, 95, 85, 75, 65, 55, 0
        11. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        12. Extra Credit What can you think of to do to make this program better?

    11 09/19/07 Wednesday - Pledge & Announcements, "vbTicTacToe"
    1. Classroom Discussion -
      1. One AM student needed as volunteer to assist with the morning pledge & announcements
      2. Parental/Guardian signed forms due: no computer contract = no computer use
      3. Review Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 7 - Making Decisions
      4. Visual Basic Techniques:
        • Line Object - demo on board, properties
        • Keeping track of the next player - demo on board
        • Change a command button caption by clicking on the button
        • Prevent a second click on a button that's already been clicked once
        • Check for a winner
        • After finding a winner, prevent any more clicks
        • Use a Reset command button to restart the game
    2. Lab Assignment -
      1. Job Seeking Skills Pre-Test. Click the link & follow the instructions. You get one shot at this one, but it doesn't count. You'll take it again in June to see how much you've learned about job seeking
      2. Create a Visual Basic game of Tic Tac Toe: ticTacToeDemo
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "frmTicTacToe.frm" & "vbTicTacToe.vbp"
        3. Design the form:
          • Exit button, write & test the code
          • Nine command buttons arranged 3 by 3 for the game board named:
            cmdTopLeft cmdTopCenter cmdTopRight
            cmdMidLeft cmdMidCenter cmdMidRight
            cmdBotLeft cmdBotCenter cmdBotRight
          • Place line objects between the buttons for visual effect
          • A label with general instructions
          • Another label to display which player plays next
        4. Remember to use
          Option Explicit
          as the first line in your code window
        5. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        6. Declare Variables:
            Dim intMesRet As Integer ' which button the user clicked on in a message window
            Dim strNextPlay As String ' either "X" or "O" to indicate which player plays next
            Dim blnWinner As Boolean ' prevent further play if you have a winner
            
        7. Code for Form_Load()
          • Create the form load subroutine by double-clicking in a blank area of the form
          • Initialize first player to "X"
            strNextPlay = "X"
          • Show next player on form
            lblNextPlay.caption = strNextPlay
          • Initialize to no winner
            blnWinner = false
          • Set top left command button captions to blank
            cmdTopLeft.caption = ""
          • Set all the other command buttons captions
        8. Code for cmdTopLeft:
          • Only allow clicks if there is no winner yet
          • Only allow clicks if the button has not already been clicked
          • Change the button caption to which player plays next
          • Change the variable that indicates which player plays next
          • Display who plays next
          • Check for a winner
          • Here's the code:
            If Not blnWinner Then ' only if no winner yet
                ' only if blank (not "X" and not "O")
                If cmdTopLeft.Caption <> "X" And cmdTopLeft.Caption <> "O" Then
                    cmdTopLeft.Caption = strNextPlay ' change button caption to "X" or "O"
                    If strNextPlay = "X" Then ' change next player
                        strNextPlay = "O"
                    Else
                        strNextPlay = "X"
                    End If
                    lblNextPlay.Caption = strNextPlay ' show who plays next
                    checkWinner ' check for a winner
                End If ' end if not blank
            End If ' end if no winner
            
        9. Code for cmdTopCenter:
          • Copy the code from cmdTopLeft to cmdTopCenter
          • Change all references from topleft to topcenter
          • Test it
        10. Repeat copy & change for each of the other seven buttons, testing each time ticTacToeDemo2
        11. Consider how to check for a winner -- how many ways can you score three in a row?
          1. Top row horizontal
          2. Middle row horizontal
          3. Bottom row horizontal
          4. Left column vertical
          5. Center column vertical
          6. Right column vertical
          7. Top left to bottom right diagonal
          8. Top right to bottom left diagonal
        12. Code the top-row-horizontal check-for-winner & announce a winner & test it
        13. Copy & paste the top-row-horizontal check-for-winner & change for middle-row-horizontal
        14. Copy & paste & change for the other row & column & diagonal
        15. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        16. Extra Credit Keep track of & display how many wins for "X" & how many wins for "O"
        17. Extra Credit Create a [Reset] command button & write the code
        18. Extra Credit Tell the user if there is a tie (all buttons filled but no winners)

    12 09/20/07 Thursday - Pledge & Announcements, Microsoft PowerPoint, Math
    1. Classroom Discussion -
      1. One AM student needed as volunteer to assist with the morning pledge & announcements
      2. Parental/Guardian signed forms due: no computer contract = no computer use
      3. Parts of a computer according to build-your-own-computers.com
        • Computer Case
        • Motherboard
        • CPU
        • Memory (RAM)
        • Monitor
        • Hard drives & Floppy Drives
        • CD & DVD Drives
        • Video Card
        • Keyboard & Mouse
        • Sound
        • NIC
      4. Microsoft PowerPoint Online Tutorial from Microsoft
      5. Math with Ms. Verde
    2. Lab Assignment - img_insidecase
      1. Microsoft PowerPoint pratice
      2. Create a Microsoft PowerPoint presentation on "How to Build Your Own Computer"
        • Open Microsoft PowerPoint
        • Create a new blank presentation
        • Choose a new design (click the menu bar button or F[o]rmat, Slide [D]esign
        • Save the presentation to the "My Documents" folder
        • Use the filename "css##-Build Your Own Computer.ppt" (use your own css number)
        • Title the presentation "How to Build Your Own Computer"
        • Add your name & Computer Science as the sub-title on the first page
        • Insert a new page
        • Title the new page "The Computer Case"
        • Add some simple text describing the computer case - perform a Google search if you don't know how a part works
        • Locate & copy an image of the computer case (you don't need to save to "My Documents")
        • Paste the copied image to the new page
        • Repeat for each of the computer parts listed above
        • Insert a "Conclusions" or "Summary" or "Questions" or "Sources" page at the end
        • Save frequently
        • Run the slideshow to see how your presentation looks
        • I will copy these presentations to your "H:" drive when we get back to our regular classroom

    13 09/21/07 Friday - Pledge & Announcements, Grade Print Sheet, Finish Tic Tac Toe, VB IF THEN ELSE Statement, "vbSalary2", VB Nested IF THEN ELSE Statement, "vbGrades2"
    1. Classroom Discussion -
      1. One AM student needed as volunteer to assist with the morning pledge & announcements
      2. Parental/Guardian signed forms due: no computer contract = no computer use
      3. Review Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 7 - Making Decisions
      4. Review Arithmetic Operators, String Aritmetic Operator, Comparison Operators, Comparison Rules
      5. The VB IF THEN ELSE Statement:
        • Allows the computer to make a choice between two possible processes
        • Syntax:
          If comparisonTest Then
          	' One or more Visual Basic statements A
          Else
          	' One or more Visual Basic statements B
          End If
          
        • IF the comparison returns a True result THEN statements before the ELSE are performed
        • IF the comparison returns a False result THEN statements after the ELSE but before the END IF are performed
      6. Review Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 7 - Making Decisions
      7. Nested VB IF THEN ELSE Statements:
        • Allows the computer to make multiple decisions between multiple choice processes
        • Syntax:
          If comparisonTest1 Then
          	If comparisonTest2 Then
          		' One or more Visual Basic statements A
          	Else
          		' One or more Visual Basic statements B
          	End If
          Else
          	If comparisonTest3 Then
          		' One or more Visual Basic statements C
          	Else
          		' One or more Visual Basic statements D
          	End If
          End If
          
        • IF comparison1 returns a True result THEN comparison2 is tested
        • IF comparison2 returns a True result THEN statements A are performed
        • IF comparison2 returns a False result THEN statements B are performed
        • IF comparison1 returns a False result THEN comparison3 is tested
        • IF comparison3 returns a True result THEN statements C are performed
        • IF comparison3 returns a False result THEN statements D are performed
        • Note: The indentation really does nothing for the compiler; it just makes it easier for us simple humans to read
    2. Lab Assignment -
      1. Modify your vbSalary program to work with overtime. Program Logic:
        1. Hours worked up to & including 40 is normal time & receives normal pay
        2. Any hours worked over 40 is considered overtime & receives 1.5 times pay rate
        3. Only hours worked over 40 gets time & a half & this is added to normal 40 hour pay
        4. The computer must make a decision - use an IF THEN ELSE statement
        Some ideas:
        1. Modify the command button where the work is done:
          If sngHoursWorked <= 40 Then
          	sngGrossPay = sngHoursWorked * sngPayRate
          Else
          	sngGrossPay = (40 * sngPayRate) + ((sngHoursWorked - 40) * sngPayRate * 1.5)
          End If
          
        2. Test all possibilities: 30 hours, 40 hours, 50 hours
        3. Test with these numbers. If you enter hours & rate, your resulting gross, taxes, & net should be the same as mine:
          hours rate gross taxes net
          30 10 300 60 240
          40 10 400 80 320
          50 10 550 110 440
        4. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        5. Extra Credit Hours over 60 get double time
      2. Modify your vbGrades program to use nested IF THEN ELSE statements. Program Logic:
        1. Perform nested testing to determine where the number grade is
        Some ideas:
        1. Modify the command button where the work is done:
          intNumGrade = txtInput.Text
          If intNumGrade >= 93 Then
            strLetGrade = "A"
          ElseIf intNumGrade >= 85 Then
            strLetGrade = "B"
          ElseIf intNumGrade >= 75 Then
            strLetGrade = "C"
          ElseIf intNumGrade >= 65 Then
            strLetGrade = "D"
          Else
            strLetGrade = "F"
          End If
          lblOutput.Caption = strLetGrade
          
        2. Extra Credit Add a comment as to how well the student is doing (A=Fantastic, B=Good Job, etc.)

    14 09/24/07 Monday - Technology Boolean Logic, VB SELECT CASE Statement, "vbGrades"
    1. Classroom Discussion -
      1. Definitions, from Dictionary.com:
        • Algebra - A branch of mathematics in which symbols, usually letters of the alphabet, represent numbers or members of a specified set & are used to represent quantities & to express general relationships that hold for all members of the set venn-stainedglass-gonville-caius
        • Origins of the word Algebra:
        • George Boole (1815-1864) - British mathematician & logician who developed a calculus of symbolic logic:
        • Boolean - Of or relating to a logical combinatorial system treating variables, such as propositions & computer logic elements, through the operators AND, OR, NOT, & XOR:
        • Boolean Algebra - An algebra in which elements have one of two values & the algebraic operations defined on the set are logical OR, a type of addition, & logical AND, a type of multiplication:
        • John Venn (1834-1923) - English logician who introduced Venn diagrams:
        • Venn Diagram - A diagram using circles to represent sets, with the position & overlap of the circles indicating the relationships between the sets
      2. Links:
        • Glencoe Boolean Door Locks - Great example of how Boolean works
        • IguanaLabs Boolean Truth Tables
        • The VB SELECT CASE Statement:
          • Simpler way to write a multi-decision, multi-choice process
          • Syntax - one value each:
            Select Case Expression1
               Case value1
                  One or more Visual Basic statements A
               Case value2
                  One or more Visual Basic statements B
               [Case value3
                  One or more Visual Basic statements C]
               [Case Else
                  One or more Visual Basic statements D]
            End Select
            
          • Expression1 is a variable
          • IF expression1 is equal to value1 THEN statements A are performed
          • IF expression1 is equal to value2 THEN statements B are performed
          • IF expression1 is equal to value3 THEN statements C are performed
          • IF expression1 is equal to none of the values THEN statements D are performed
          • Alternate Syntax - uses < & > symbols:
            Select Case Expression2
               Case Is Relation1:
                 One or more Visual Basic statements A
               Case Is Relation2:
                 One or more Visual Basic statements B
               [Case Is Relation3:
                 One or more Visual Basic statements C]
               [Case Else:
                 One or more Visual Basic statements D]
            End Select
            
          • IF expression2 is greater or less than (depending on the symbol used) relation1 THEN statements A are performed
          • IF expression2 is greater or less than (depending on the symbol used) relation2 THEN statements B are performed
          • IF expression2 is greater or less than (depending on the symbol used) relation3 THEN statements C are performed
          • IF expression2 is greater or less than (depending on the symbol used) none of the relations THEN statements D are performed
          • Alternate Syntax - give a range start to end:
            Select Case Expression3
               Case value1 To value2:
                  One or more Visual Basic statements A
               Case value3 To value4:
                  One or more Visual Basic statements B
               [Case value5 To value6:
                  One or more Visual Basic statements C]
               [Case Else:
                  One or more Visual Basic statements D]
            End Select
            
          • IF expression3 is between start value1 & end value2 THEN statements A are performed
          • IF expression3 is between start value3 & end value4 THEN statements B are performed
          • IF expression3 is between start value5 & end value6 THEN statements C are performed
          • IF expression3 is between none of the values THEN statements D are performed
          • SELECT CASE, used correctly, is a very powerful & easy-to-use programming technique
          • SELECT CASE can be much easier to write & understand than complex nested IF THEN ELSE statements
    2. Lab Assignment -
      1. Create the "vbGrades" program as defined on Tuesday & Friday last week

    15 09/25/07 Tuesday - Math Time-Value-of-Money, VB Built-in-Formulas, "vbMoney" part I
    1. Classroom Discussion -
      1. Time Value of Money - Is it better to have money now rather than later?
      2. Time Value of Money - VB Formulas:
      3. Visual Basic Pre-Defined Built-In Functions:
        • IsNumeric("string") ' returns True if string is only numbers
      4. Visual Basic Pre-Defined Built-In Functions:
    2. Lab Assignment -
      1. Create a VB program to view time-value of money Future-Value calculations: moneyDemo I want to put aside money now & see how it'll grow over time
        1. Future Value of Savings
        2. You need to know four things:
          • Value - How much you're starting with
          • Deposit - How much you'll deposit every month
          • Interest Rate - How much the bank pays you to save your money with them
          • Length of Term - How long you're planning to save
        For your calculations:
        1. Use the VB IDE to help you place the variables in the function
        Some ideas:
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "frmMoney.frm" & "vbMoney.vbp"
        3. Add textboxes for input:
          1. txtValue
          2. txtDeposit
          3. txtRate
          4. txtTerm
        4. Add a label for output:
          1. lblOutput
        5. Add labels to identify all textboxes
        6. Add instructions to the user
        7. Add variables at the top of the program:
          1. dblValue
          2. dblDeposit
          3. dblRate
          4. dblTerm
          5. dblFuture
          6. intMesRet
        8. Add command buttons:
          1. Future Value
          2. Exit
        9. Steps for the Calculate Future Value button:
          1. Test each input textbox for numeric & then convert to data type double (use "CDbl(txtInput.text)") of the textbox to the variable
          2. Assign the result of the predefined Visual Basic function "FV" to the output variable
          3. Display the variable, formatted as currency, on the output label
        10. Add a command button & code & "cancel" for exit
        11. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        12. Test & debug your program (call me for assistance). Use numbers that are easy to confirm. For example:
          Starting Value Only, No Deposits
          Value Deposit Rate Term Total Deposits Value
          100 0 5 1 $100 $105.12
          100 0 10 1 $100 $110.47
          100 0 10 10 $100 $270.70
          1000 0 10 40 $1000 $53,70.67
          Starting Value With Deposits
          Value Deposit Rate Term Total Deposits Value
          100 10 5 1 $220 $227.90
          100 10 10 1 $220 $236.13
          100 10 10 10 $1,300 $2,319.15
          1000 100 10 40 $49,000 $686,10.86
        13. Extra Credit Calculate & display the extra money gained through interest over time

    16 09/26/07 Wednesday - Career Job-Seeking-Skills pre-test, "vbMoney" part II
    1. Classroom Discussion -
      1. Flyers on Board
      2. Ocean County College registrations form due Monday, October 1st
      3. Career - Job Hunting
      4. Time-Value of Money - the Rule of 72
      5. Visual Basic Pre-Defined Built-In Functions:
        • IsNumeric("string") ' returns True if string is only numbers
      6. Visual Basic Pre-Defined Built-In Functions:
    2. Lab Assignment -
      1. Modify the time-value of money VB program to view Payment calculations: money2Demo I want to see how much I have to pay each month to pay off a loan
        1. How much will you need to save each month to reach a certain value
        2. You need to know three things:
          • Value - How much you have to pay off at the end of the term
          • Interest Rate - How much the bank is charging you for you to borrow their money
          • Length of Term - How long you have to pay
        For your calculations:
        1. Use the VB IDE to help you place the variables in the function
        Some ideas:
        1. Modify your existing "money.vbp" to add a new process
        2. Add a new command button:
          1. Calculate Payment
        3. Steps for the Calculate Future Value button:
          1. Test each input textbox for numeric & then convert to data type double (use "CDbl(txtInput.text)") of the textbox to the variable
          2. Assign the result of the predefined Visual Basic function "PMT" to the output variable
          3. Display the variable, formatted as currency, on the output label
        4. Add a command button & code & "cancel" for exit
        5. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        6. Test & debug your program (call me for assistance). Use numbers that are easy to confirm. For example:
          Final Rate Term Value
          1000 3 3 $26.58
          10000 3 5 $154.69
          20900 2.99 5 $323.38
          25000 3 5 $386.75
        7. Extra Credit Calculate & display the true cost of the loan

    17 09/27/07 Thursday - English 2nd-Year Students visit with Ms. Gerick, "vbDates"
    1. Classroom Discussion -
      1. Ocean County College registrations form due Monday, October 1st
      2. English: Second-year students will visit with Ms. Gerick to work on a portfolio
      3. Vocabulary:
        • Data Validation: the process of ensuring that a program operates on clean, correct and useful data (wikipedia.org)
      4. Visual Basic Pre-Defined Built-In Functions:
        • Date ' returns today's date as data type date
        • IsDate("string date") ' returns True if the string date is a valid date
        • CVDate("string date") ' returns the string date as data type date
      5. Visual Basic Pre-Defined Built-In Functions:
    2. Lab Assignment -
      1. Create a Visual Basic program called "dates" to calculate how many days are between two user-entered dates datesDemo
        1. How will you allow the user to enter two dates?
        2. What data type will you use to store the two user-entered dates?
        3. What data type will you use to store the difference between the two dates?
        4. How will you display the answer to the user?
        For your calculations:
        1. Supply today's date for the user to either accept or change
        Some ideas:
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "dates.frm" & "dates.vbp"
        3. Add 2 textbox for input & a label for output:
          1. txtDate1
          2. txtDate2
          3. lblOutput
        4. Add labels to identify the textbox
        5. Add variables at the top of the program:
          1. intMesRet
          2. dte1
          3. dte2
          4. intDaysBetween
        6. Add command buttons:
          1. cmdGo
          2. cmdExit
        7. Program & test the Exit command button
        8. Steps for the Go command button:
          1. Use "IsDate()" to ensure that the user entered a valid txtDate1.text
          2. Else display an appropriate error message & set the focus to txtDate1
          3. Use "IsDate()" to ensure that the user entered a valid txtDate2.text
          4. Else display an appropriate error message & set the focus to txtDate2
          5. Continue only if both textbox are valid dates
          6. Convert txtDate1.text to data type date & store in variable dte1
          7. Convert txtDate2.text to data type date & store in variable dte2
          8. Calculate the difference between the two date variables & store in variable intDaysBetween
          9. Display variable intDaysBetween to the user on lblOutput.caption with an appropriate message
        9. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        10. Extra Credit Always display a positive number of days between, never a negative, for example: 9/05-9/25 = -18

    18 09/28/07 Friday - SkillsUSA, Visual Basic Quiz 3, "vbMadLibs"
    1. Classroom Discussion -
      1. Ocean County College registrations form due Monday, October 1st
      2. Skills USA
      3. Technology Vocabulary:
        • Concatenate - To arrange (strings of characters) into a chained list
        • Mad Libs - wikipedia.org - definition
        • penguinGroup.com - Mad Libs online game & instructions
        • The concatenate symbol is " & "
        • Examples:
          dim strWord1 as String
          dim strWord2 as String
          dim strOutput as String
          strword1 = "large"
          strword2 = "house"
          strOutput = "Hello " & "World!"
          strOutput = "Hello " & strWord1 & " World!"
          strOutput = "Hello " & strWord1 & " " & strWord2 & " World!"
          strOutput = "Hello " & txtFirstName.Text & " " & txtLastName.Text & _
          	", Welcome to my " & strWord1 & " " & strWord2
          
          VB Syntax to add to an existing string variable:
          strOutput = "First line of text" & VbCrLf
          strOutput = strOutput & "Second line of text" & VbCrLf
          strOutput = strOutput & "Third line of text" & VbCrLf
          strOutput = strOutput & "Fourth line of text" & VbCrLf
          
          Here's how the above code will display:
          First line of text
          Second line of text
          Third line of text
          Fourth line of text
          
    2. Lab Assignment -
      1. Create a Visual Basic program called "madLibs" to play the famous game on computer
        madLibsDemo Use between five (5) & ten (10) user-supplied words:
        1. What story will you chose? Will you make one up? Will you borrow one from the internet?
        2. What words will you replace in the story with user-supplied words?
        3. How will the user enter the words to be replaced?
        4. What variables will you need? What data types?
        5. How will you display the changed story to the user?
        Some ideas:
        1. Open VB & create a new, standard.exe
        2. Save the form & project to your "My Documents/vb" folder as "madLibs.frm" & "madLibs.vbp"
        3. Add up to 10 textbox for input
        4. Use a textbox for output so the user may highlight & copy the madlibs story
        5. Name each input textbox & output textbox appropriately
        6. Set the output textbox properties "MultiLine = True" & "ScrollBars = 2 - Vertical"
        7. Add labels to identify what the user needs to type into each textbox
        8. Add any variables at the top of the program & be sure to use Option Explicit
        9. Add & program & test the EXIT command button
        10. Add & program a GO command button:
          1. Sequentially test each input textbox for not blank
          2. It any input textbox is blank, use a msgbox to tell the user & set the focus to that input textbox
          3. Use concatenation to build the story output variable
          4. Mix the words the user has entered into the textboxes with the existing story
          5. Display the story output variable onto the output textbox
        11. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        12. Extra Credit Let the user choose from more than one story & use the same user-supplied words

    19 10/01/07 Monday - VB Loops, "vbNumberLoops"
    1. Classroom Discussion -
      1. Definitions:
        • Loop - A sequence of instructions that repeats either a specified number of times or until a particular condition is met
        • Iterate - To say or perform again
        • Iteration - The process of repeating a set of instructions a specified number of times or until a specific result is achieved
        • Infinite Loop - One that never terminates
        • Sentinel - One that keeps guard
        • Sentinel Variable - A variable that changes to determine when a program loop stops looping
      2. Usage:
        • Works with comparison tests, just like decisions
        • The six comparision operators (  <    >    =    <=    >=    <>  ) work just the same
        • The block of code continues being interpreted & executed as long as the comparison returns a TRUE result
        • When the comparison returns a FALSE result, the loop ends & the program continues with the first statement after the LOOP statement
        • It's possible to have a loop where the comparison test returns a FALSE the first time it's tested - the block of statements will never be executed
        • It's also possible to have a loop where the comparison test never changes to return a FALSE & therefor never exits
        • A never-ending-loop is one where the sentinel variable never changes so that the comparison never returns a FALSE condition & the loop never ends
      3. Rules: STP
        • Sentinel Variable - The variable that will be tested as part of the comparison
        • Start - Initialize the sentinel variable to some value before the start of the loop
        • Test - The comparison test will determine if the block of statements in the loop execute
        • Change - Modify the value of the sentinel variable inside the loop block
      4. Warnings:
          SAVE YOUR PROGRAM
          BEFORE TESTING A LOOP
        • You'll get an infinite loop if the sentinel variable does not change to make the comparison FALSE
        • If an infinite loop condition occurs, you may have to reset your computer & will lose any changes that have not been saved
        • If you get an infinite loop, wait, Windows may detect it & display a message box saying you have a slow running program & asking if you want to abort it - answer yes
      5. Loop Safety:
        • You set it up during testing
        • Create a variable Dim intSafety As Integer
        • Before you start the loop, initialize intSafety = 0
        • Inside the loop, decrement intSafety = intSafety + 1
        • Inside the loop, test If intSafety > 10000 Then display an exit message & End Sub
      6. VB Picture Box object - can display (print) multiple lines:
        picOutput.Print ("hello world") ' print string literal
        strOutput = "My name is Mike" ' initialize a variable
        picOutput.Print (strOutput) ' print a variable
        
      7. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      8. Loop Syntax:
        • Syntax of the DO WHILE LOOP:
          Do While comparisontest1
             Block of one or more Visual Basic statements A
             Change the sentinel variable
          Loop
          
          DO WHILE will execute statements A while comparisontest 1 is TRUE
          If FALSE the first time, statements A will never be executed
        • Syntax of the DO UNTIL LOOP:
          Do Until comparisontest2
             Block of one or more Visual Basic statements B
             Change the sentinel variable
          Loop
          
          DO UNTIL will execute statements B until comparisontest 2 becomes TRUE
          If TRUE the first time, statements B will never be executed
        • Syntax of the DO LOOP WHILE:
          Do
             Block of one or more Visual Basic statements C
             Change the sentinel variable
          Loop While comparisontest3
          
          Similar to the DO UNTIL execute statements C while comparison test 3 is TRUE
          Will ALWAYS execute statements C at least once
        • Syntax of the DO LOOP UNTIL:
          Do
             Block of one or more Visual Basic statements D
             Change the sentinel variable
          Loop Until comparisontest4
          
          Similar to the DO UNTIL execute statements D until comparison test 4 becomes TRUE
          Will ALWAYS execute statements D at least once
        • Syntax of the FOR NEXT:
          For counterVar = startVal To endVal [Step incrementVal]
             Block of one or more Visual Basic statements E
             The sentinel variable (counterVar) changes automatically
          Next CounterVar
          
          Will execute statements E (endVal - startVal) times
          If startVal is greater than endVal, will not execute statements E at all
    2. Lab Assignment -
      1. On-screen practice with Picture Box object & print:
        • Add a picture box object titled "picOutput", make it large
        • Display "Hello World" to the picture box object inside a command button event
        • Initialize a string variable & display the contents
        • Use "picOutput.Cls" inside another command button event to clear screen the picture box
      2. Create a Visual Basic program "vbNumberLoops" to display number sequences:
        • Display a series of numbers from 1 to 10
        • Display odd numbers from 1 to 10
        • Display multiples of three (3,6,9,etc.)
        • Use a textbox to get a start number where the user wants the loop to begin
        • Use a textbox to get a stop number where the user wants the loop to end
        • Use a textbox to get a step number how the user wants to skip (ie: 2 4 6 or 3 6 9 etc.)
        • Extra Credit Modify your "vbNumberLoops" program to display the sum of all numbers between user supplied start & stop numbers

    20 10/02/07 Tuesday - VB Loop Practice, "vbPrime", "vbFactorial"
    1. Classroom Discussion -
      1. Respect - wikipedia.org
      2. Respect - dictionary.com
      3. Respect - goodCharacter.com
      4. Responsibility - goodCharacter.com
      5. Responsibility - dictionary.com
      6. Review VB Loops
      7. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      8. Definitions:
        • Sum - an amount obtained as a result of adding numbers
          for example: the first five integers from 1 to 5 = 1 + 2 + 3 + 4 + 5 = 15
        • Factorial - the product of all the positive integers from 1 to a given number
          for example: the first five integers from 1 to 5 = 1 * 2 * 3 * 4 * 5 = 120
        • Prime - a positive integer not evenly divisible by any positive integer other than itself & one
          for example: 2 is Prime, 3 is Prime, 5 is Prime
          besides 2, no even number is Prime
      9. Visual Basic MOD - divide two numbers & return only the remainder as an integer
        intRemainder = 5 mod 3 ' returns 2
        
        Useful to see if a number can be divided evenly by another number
        intRemainder = 5 mod 2 ' returns 1 - means that 5 is an odd number
        intRemainder = 6 mod 2 ' returns 0 - means that 6 is an even number
        
        Here is an example:
        intSentinel = 1
        Do While intSentinel < 25
            If intSentinel Mod 2 = 0 Then
                picOutput.Print (intSentinel & " is an even number")
            End If
            intSentinel = intSentinel + 1
        Loop
        
    2. Lab Assignment -
      1. Pen & Paper Assignment:
        • Write your name & today's date on top of the paper
        • Hand in when complete
        • Hand-write the syntax of the five (5) different VB loops
        • After each loop syntax, write an example of a program segment that will display numbers from 1 to 10
        • For example (here's the first loop)
          1st LOOP SYNTAX:
          Do While comparison
          	Perform these statements
          	Change the sentinel variable
          Loop
          
          1st LOOP EXAMPLE:
          intCount = 1
          Do While intCount <= 10
          	txtOutput.Text = txtOutput.Text & intCount & VbCrLf
          	intCount = intCount + 1
          Loop
          
      2. Create a Visual Basic program "vbSumsOfConsecutiveNumbers" to display sums of consecutive numbers starting with a user supplied number & a user supplied "how many"
      3. Create a Visual Basic program "vbFactorial" to display Factorial for a user supplied number
      4. Create a Visual Basic program "vbPrime" to display if a user supplied number is Prime or not
      5. Extra Credit Modify "vbPrime" to display all the Prime numbers between 2 & a user supplied number

    21 10/03/07 Wednesday - Career, VB Loop Practice, "vbStars"
    1. Classroom Discussion -
      1. Career - 7 Steps to Get a Job:
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      3. Review VB Loops
      4. Syntax of the FOR NEXT:
        For counterVar = startVal To endVal [Step incrementVal]
           Block of one or more Visual Basic statements E
           The sentinel variable (counterVar) changes automatically
        Next CounterVar
        
        Will execute statements E (endVal - startVal) times
        If startVal is greater than endVal, will not execute statements E at all
    2. Lab Assignment -
      1. Create a new Visual Basic program to use loops to draw shapes with one character:
        • Open Visual Basic & create a new standard executable
        • Name the form "frmStars.frm" & the project "vbStars.vbp"
        • Add a large picture box object for output
        • Add a textbox object & label for to let the user specify how many
        • Add a textbox object & label for to let the user specify the symbol
        • Add a command button object & code to draw one symbol
        • Add a command button object & code to draw a row of symbols
        • Add a command button object & code to draw a box of symbols
        • Add a command button object & code to draw a right triangle of symbols
        • Add a command button object & code to draw a left-sided right triangle of symbols
        • Add a command button object & code to draw an isosceles triangle of symbols
        • Extra CreditAdd a command button object & code to draw a diamond (2 isosceles triangles touching at the bottoms, the lower triangle upside-down)
        • Extra CreditAdd a command button object & code to draw an hourglass (2 isosceles triangles touching at the tips, the upper triangle upside-down)

    22 10/04/07 Thursday - English, VB Loop Review, Quiz VB Decisions & Loops, "vbGCD"
    1. Classroom Discussion -
      1. Reminder - No School on:
        • Friday - October 5th - Teacher In-Service
        • Monday - October 8th - Columbus Day
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      3. Review VB Loops
    2. Lab Assignment -
      1. Visual Basic Quiz 2. 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
      2. Quiz Part II - Design, write, create, test, run, & save a Visual Basic program to determine the Greatest Common Denominator between two input numbers. GCD is found by determining the highest number that divides evenly into both of the two input numbers. For instance:
        given num1 = 12 & num2 = 18 then gcd = 6
        given num1 = 12 & num2 = 21 then gcd = 3
        given num1 = 12 & num2 = 24 then gcd = 12
        given num1 = 12 & num2 = 28 then gcd = 4
        given num1 = 28 & num2 = 12 then gcd = 4
        
        • Run a loop
        • Stop when you reach the smaller number
        • Keep track of whenever you find a number that divides evenly into both input numbers
        • Call your form "frmGCD.frm" & your project "vbGCD.vbp"
        • Think before you start
          • What form objects will you use?
          • What variables will you use?
          • What processes will you use?
          • How do you determine a denominator?
          • How do you determine the greatest common denominator?
        • Test frequently
        • 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
      3. Grading Criteria:
        1. Form must be named
        2. Form objects (except labels) must be named
        3. You must have your name, date, & program name as comments at the top of the code
        4. You must use "Option Explicit"
        5. Variables must be named & declared
        6. Exit button must ask if I really want to exit
        7. Determine button must provide the correct answer to all test input. I will test with the numbers given above
        8. Output must echo user input so that the user can see & fix his own misteaks
        9. Output must show the correct answer
        10. Use enough text in the output to describe what the numbers mean
        11. 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
        12. Take as much time as you need to get it right
      4. If we have time, we'll complete the vbStars loop practice program from yesterday on the board together
      5. HAVE A GRAND WEEKEND!!!

    10/05/07 Friday - OCVTS School Closed - Teacher In-Service

    10/08/07 Monday - OCVTS School Closed - Columbus Day
    23 10/09/07 Tuesday - VB Loop Practice, "vbFactorial"
    1. Classroom Discussion -
      1. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      2. Vocabulary Definitions:
        • Factorial - the product of all the positive integers from 1 to a given number
          for example: Factorial the first five integers from 1 to 5 = 1 * 2 * 3 * 4 * 5 = 120
        • Flowchart - a schematic representation of a sequence of operations, as in a manufacturing process or computer program
        • wikipedia.org
        • Pseudocode - a notation resembling a programming language but not intended for actual compilation. It usually combines some of the structure of a programming language with an informal natural-language description of the computations to be carried out
      3. Boolean Logic in Programming
        NOT TRUE FALSE
        FALSE TRUE
        (make opposite)
           
        OR TRUE FALSE
        TRUE TRUE TRUE
        FALSE TRUE FALSE
        (ONE must be TRUE)
           
        AND TRUE FALSE
        TRUE TRUE FALSE
        FALSE FALSE FALSE
        (BOTH must be TRUE)
      4. Boolean Logic in Programming & PEMDAS
        1. Parenthesis
        2. AND is like Multiply
        3. OR is like Add
        4. The AND pair will compare before the OR pair
        5. To make the OR pair compare before the & pair, you MUST USE PARENTHESIS!!!
      5. Boolean Logic in Programming Examples. Use NOT to reverse the logic:
        • NOT TRUE
        • NOT FALSE
        • NOT intMesRet = vbNo
        • NOT strQuitGame = vbYes
        Use OR to compare two possible answers to the same variable:
        • strDirection = "up" OR strDirection = "down"
        • strAnswer = "YES" OR strAnswer = "yes"
        • intAge = 17 OR intAge <> 17
        • strHaveCar = "Y" OR strHaveCar = "y"
        • dtmDay = "Saturday" OR dtmDay = "Sunday" OR blnHoliday = TRUE
        • isNumeric(txtNum1.text) OR isNumeric(txtNum2.text)
        • strHaveCar = "Y" OR strHaveRide = "Y" OR strBusRide = "Y"
        • strTrafficLight = "Yellow" OR strTrafficLight = "Red" OR strTrafficSign = "Stop"
        • strTrafficLight = "Red" OR blnCarInFrontOfYou = TRUE
        Use & to compare two possible answers to different variables:
        • strDirection = "up" AND strAnswer = "yes"
        • intAge >= 17 AND strHaveCar = "Y"
        • dtmDay = "Monday" AND blnHoliday = TRUE
        • isNumeric(txtNum1.text) AND isNumeric(txtNum2.text)
        • strTrafficLight = "Yellow" AND blnJustTurnedYellow = FALSE
        • strTrafficLight = "Yellow" AND intTurnedYellowSeconds > 5
        • strTrafficLight = "Green" AND blnCarInFrontOfYou = FALSE
        • cmdTopLeft <> "" AND cmdTopLeft = cmdTopCenter AND cmdTopCenter = cmdTopRight
        Use complex logic & PEMDAS to compare different combinations of answers:
        • strHaveCar = "Y" AND strHaveLicense = "Y" OR strBusRide = "Y"
        • blnSchoolOpen = TRUE AND strHaveRide = "Y" OR strBusRide = "Y"
        • blnSchoolOpen = TRUE AND (strHaveRide = "Y" OR strBusRide = "Y")
    2. Lab Assignment -
      1. Create a Visual Basic program "vbFactorial" to show the factorial of a user-entered number:
        • Product means multiply
        • Design the form:
        • Define your variables:
          Option Explicit
          Dim intMesRet As Integer ' for messages
          Dim intNum As Integer ' to hold the number the user wants to factorialize
          Dim lngFact As Long ' to hold the factorial product value
          Dim intCount As Integer ' the sentinel variable
          
        • Write the code for the cmdExit button
        • Write the code for the cmdFact button: (This is called "pseudo-code")
          If the value in the input textbox is not numeric
          	Tell the user & place the focus
          Else
          	If the value in the textbox is larger than 12
          		Tell the user that bigger than 12 is no good & use 5
          	end if
          	Assign the value of 1 to lngFact
          	Assign the value from the input textbox to intNum
          	Initialize the sentinel variable to 1
          	Loop while the sentinel is less than or equal to intNum
          		Assign the result of lngFact times intCount to lngFact
          		Increment the sentinel
          	End loop
          	Display the output to the user
          End If
          
      2. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive

    24 10/10/07 Wednesday - College-Bound Planning, "vbPrime"
    1. Classroom Discussion -
      1. Career - College-Bound High School Senior Planning Calendar
      2. Prime - a positive integer not evenly divisible by any positive integer other than itself & one
        for example: 2 is Prime, 3 is Prime, 5 is Prime
        besides 2, no even number is Prime
      3. Modulus - an operation that finds the remainder of division of one number by another as a whole integer number
      4. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      5. Review of Boolean Logic in Programming
    2. Lab Assignment -
      1. Create a new Visual Basic program "vbPrime" to say if a user-entered number is Prime or not:
        • Open VB & create a new executable named "vbPrime"
        • Design the form to accept a user-selected number as input, an output area, & two command buttons (Is It Prime? & Exit)
        • Get a number from the user
        • Ensure that the user number is a whole positive integer number
        • Remember - if any number between 2 and 1 less than the number can divide evenly - the user number is not Prime
        • You must test divide each number between 2 & 1 less than the user number in a loop
        • If any number divides evenly (modulus = 0), use a variable to remember that the user number is not Prime
        • When the loop ends, report if the user number is Prime or not Prime
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra Credit If a number is NOT Prime, tell the user why, something like:
          2 divides evenly into 24
          3 divides evenly into 24
          4 divides evenly into 24
          6 divides evenly into 24
          8 divides evenly into 24
          12 divides evenly into 24
          24 is NOT Prime
          

    25 10/11/07 Thursday - Guest Speaker from NJIT, modify "vbPrime"
    1. Classroom Discussion -
      1. Guest speaker from NJIT (10:00 am & 11:00 am)
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      3. Review of Boolean Logic in Programming
    2. Lab Assignment -
      1. Modify the VB program "vbPrime" from yesterday:
        • Add a command button "cmdShowPrimes"
        • Program the button to display all Prime numbers between 2 & a user-selected number
        • Create variables (if you haven't already):
          userNumber
          intSentinel_1
          intSentinel_2
          isPrime
          strOut
          
        • Pseudocode:
          if the input textbox is not numeric
          	tell the user
          	set the focus
          else
          	save the textbox as a userNumber variable
          	initialize intSentinel_1 to 2 ' 0 & 1 are not Prime
          	loop_1 from 2 through userNumber ' run them all
          		'determine if intSentinel for loop_1 is Prime
          		initialize intSentinel_2 to 2 ' start at 2
          		initialize isPrime to True ' assume intSentinel_1 is Prime
          		initialize strOut to Null ' ("")
          		loop_2 from 2 through half of intSentinel_1 ' run through half
          			' half of 23 (1 - 12) because 13 - 22 will NEVER divide evenly into 23
          			if (intSentinel_1 mod intSentinel_2) = 0 ' no remainder
          				set isPrime to False ' because no remainder, intSentinel_1 is NOT Prime
          				set intSentinel_2 equal to intSentinel_1 ' end loop_2 early
          			end if
          		end loop_2
          		if isPrime = True
          			display intSentinel_1
          		end if
          	end loop_1
          end if
          
        • Text with numbers you know: Prime numbers between 2 & 23 are: 2, 3, 5, 7, 11, 13, 17, 19, 23
        • 23 is Prime, so if you display all Primes between 2 & 23, 23 should be displayed as prime
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra Credit Get rid of the last comma

    26 10/12/07 Friday - Quiz Boolean Logic, "vbTimesTable", "vbTimesTableGame"
    1. Classroom Discussion -
      1. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 8 - Visual Basic Looping
      2. Review of Boolean Logic in Programming
      3. Vocabulary:
        • Random - unpredictable
        • Random Number - a number chosen by a random sampling, as from a table (random number table) or generated by a computer
        • VB6 Rnd() Function - returns a pseudo-random number between 0.0 & 0.9999999
        • To get a number between intHigh & intLow use where intHigh is the highest & intLow is the lowest possible number you want:
          intRandomNumber = ((intHigh - intLow + 1) * Rnd) + intLow
          
        • For example, to simulate a roll of 2 dice (return 2 numbers between 1 & 6) use:
          intHigh = 6
          intLow = 1
          intDie1 = ((intHigh - intLow + 1) * Rnd) + intLow
          intDie2 = ((intHigh - intLow + 1) * Rnd) + intLow
          intDiceTotal = intDie1 + intDie2
          
      4. vbExplorer.com - Random Numbers Tutorial
    2. Lab Assignment -
      1. Boolean Logic Quiz. 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
      2. Create a new VB program "vbTimesTable":
        • Create a new VB executable
        • Add 2 command button objects & 1 textbox object
        • Name the objects
        • Write the code for the Exit button
        • Write the code for the Go button to display a times table in the picture box
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra Credit Right align the numbers in the columns:
          LeftRight
          (Wrong)(Right)
          11
          1010
          100100
      3. Create a new VB program "vbTimesTableGame":
        • Create a new VB executable
        • Add command button objects & 1 textbox object
        • Name the objects
        • Write the code for the Exit button
        • Write the code for the New Problem button to randomly choose & display two numbers between 1 & 12
        • Write the code for the Check Answer button to determine if the user answer is correct
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra Credit Create & code a Clear All command button objectto clear all display objects
      4. Complete any incomplete programs

    27 10/15/07 Monday - Sub-Routines, "vbDistanceConverter"
    1. Classroom Discussion -
      1. Definitions:
        • Procedure - An ordered set of tasks for performing some action
        • Routine - A section of a program that performs a particular task
        • Subroutine - A set of instructions that performs a specific task for a main routine, requiring direction back to the proper place in the main routine on completion of the task
        • Function - A named section of a program that performs a specific task
        • The terms routine, procedure, function, & subroutine are synonymous
        • Synonymous - Having the same or a similar meaning
        • Some programming languages (Visual Basic) make a distinction between a function, which returns a value, & a procedure, which performs some operation but does not return a value
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
      3. Examples:
        ' Subroutine calling statement
        Call getNormalPay()
        
        ' Subroutine called statement
        Private Sub getNormalPay()
        sngGrossPay = (sngHoursWorked * sngPayRate)
        End Sub
        
        ' Function calling statement
        sngGrossPay = getNormalPay()
        
        ' Function called statement
        Private Function getNormalPay() As Single
        getNormalPay = (sngHoursWorked * sngPayRate)
        End Function
        
    2. Lab Assignment -
      1. Onboard demo & practice with sub-routines
      2. Write a VB program "vbDistance" to use sub-routines to convert user-supplied distance number from English to metric & back:
        • Convert between these distances:
          • Inches & Centimeters
          • Feet & Meters
          • Miles & Kilometers
        • Design the form:
          • 1 Textbox Object for input
          • 6 Command Button Objects for event processes
          • 1 Label Object for output
          • Name the Objects
          • Labels to tell the user what to do
        • Create Global variables:
          Option Explicit
          Dim sngNumIn As Single
          Dim strOutput As String
          
        • Pseudocode for the process of one command button, "cmdInchesToCentimeters":
          Ensure the input textbox is a number
          Assign the input textbox number to a variable distance input
          Calculate the converted distance as input times 2.54
          Display the converted distance with enough information so that the user knows what happened
          
        • Test
        • Code the other buttons, testing as you go
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra Credit Are there any other distances you could convert?

    28 10/16/07 Tuesday - Sub-Routines, "vbTicTacToe2"
    1. Classroom Discussion -
      1. Definitions:
        • Algorithm - A step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps
        • Flowchart - A schematic representation of an algorithm or a process
        • Schematic - A diagram that represents the elements of a system using abstract, graphic symbols rather than realistic pictures
        • Process - A naturally occurring or designed sequence of changes of properties or attributes of an object or system
        • Pseudocode - A notation resembling a programming language but not intended for actual compilation
      2. Sites:
        • Minich.com - Clean & understandable description of sub-routines & functions
      3. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
    2. Lab Assignment -
      1. Re-write the "vbTicTacToe" program to use sub-routines
        1. Reduce the program from 200 lines to 143 by using sub-routines
        2. Copy your original "vbTicTacToe" folder, rename the copy as "vbTicTacToe2"
        3. Open & modify
        4. Pseudocode:
          Move any duplicative code into sub-routines or functions
          Call the new sub-routine or function where the original lines were
          
        5. "checkWinner()" is a function, we have nine repetitious sets of four lines like this:
          If cmdTopLeft.Caption <> "" And cmdTopLeft.Caption = cmdTopCenter.Caption And cmdTopCenter.Caption = cmdTopRight.Caption Then
              blnWinner = True
              intMesRet = MsgBox("Winner is " & cmdTopLeft.Caption, vbOKOnly)
          End If
          
        6. Create a new function "inARow()" to do this stuff, using variables for each button:
          Private Function inARow(butt1 As String, butt2 As String, butt3 As String)
          If butt1 <> "" And butt1 = butt2 And butt1 = butt3 Then
              blnWinner = True
              intMesRet = MsgBox("Winner is " & butt1, vbOKOnly)
          End If
          End Function
          
        7. Now, replace each of the nine sets of four lines with this call statement:
          intMesRet = inARow(cmdTopLeft.Caption, cmdTopCenter.Caption, cmdTopRight.Caption)
          
          Changing the names of the buttons for each row, column, diagonal as required to test each of the eight possible winning combinations
        8. Test, Test, Test
        9. Now look at the code for the "cmdTopLeft_Click()" command button, we have 12 lines that repeat. I can't use variables to change the line that changes the caption on the command button:
          cmdTopLeft.Caption = strNextPlay ' change button caption to "X" or "O"
          
        10. I won't change the two lines above it
          If Not blnWinner Then ' only if no winner yet
              If cmdTopLeft.Caption <> "X" And cmdTopLeft.Caption <> "O" Then
          
        11. But I can only move the seven lines below it to another function:
          If strNextPlay = "X" Then ' change next player
              strNextPlay = "O"
          Else
              strNextPlay = "X"
          End If
          lblNextPlay.Caption = strNextPlay ' show who plays next
          checkWinner ' check for a winner
          
        12. Create a new function "changePlay()":
          Private Function changePlay()
          If strNextPlay = "X" Then
              strNextPlay = "O"
          Else
              strNextPlay = "X"
          End If
          lblNextPlay.Caption = strNextPlay
          checkWinner
          End Function
          
        13. Then replace all nine occurances of the seven lines for every button with this call statement:
          changePlay
          
        14. Test, Test, Test
        15. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive

    29 10/17/07 Wednesday - Career, Sub-Routines, "vbSalary2"
    1. Classroom Discussion -
      1. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
    2. Lab Assignment -
      1. Online career assessment from LiveCareer.com:
        1. Signup
        2. Take the 100-question assessment
        3. Choose the best answer out of the three choices
        4. Read the results
        5. Print out the chart on page 8
        6. Put your name on the printed page
        7. Hand in the chart
        Remember - Don't sign up for any advertizements & don't pay for stuff on the internet
      2. Re-write the "vbSalary" program to use sub-routines:
        • Hours Worked times Pay Rate gives Gross Pay
          ' Normal Pay Calculation:
          Gross Pay = (Hours Worked * Pay Rate)
          			
        • Calculate overtime for any hours greater than 40: ' Overtime Pay Calculation: Gross Pay = (Hours Worked * Pay Rate) + ((Hours Worked - 40) * Pay Rate * 0.5) ' Alternate Overtime Pay Calculation: Gross Pay = (40 * Pay Rate) + ((Hours Worked - 40) * Pay Rate * 1.5) ' Both the above give the same result, use whichever is easier
        • Gross Pay times 20% gives Taxes (and deductions)
        • Gross Pay minus Taxes gives Net Pay
        • Calculate overtime as 50% more pay for any Hours Worked over 40:
      3. Design the form:
        • 2 Textbox Objects for input
        • 2 Command Button Objects for event processes
        • 3 Label Object for output
        • Name the Objects
        • Labels to tell the user what to do
      4. Create Global variables:
        Option Explicit
        Dim sngHoursWorked As Single
        Dim sngPayRate As Single
        Dim sngGrossPay As Single
        Dim sngTaxes As Single
        Dim sngNetPay As Single
        
      5. Pseudocode for the process of the "cmdGo" command button:
        If the Hours Worked textbox is not numeric
        	Display an error message & set focus
        ElseIf the Pay Rate textbox is numeric
        	Display an error message & set focus
        Else
        	Assign the value in Hours Worked textbox to variable "sngHoursWorked"
        	Assign the value in Pay Rate textbox to variable "sngPayRate"
        	If Hours Worked is less than or equal to 40
        		Calculate Gross Pay as Hours Worked times Pay Rate
        	Else
        		Calculate Gross Pay as Hours Worked times Pay Rate plus 
        			(Hours Worked - 40) times Pay Rate times 50%
        	End If
        	Calculate Taxes as 20% of Gross Pay
        	Calculate Net Pay as Gross Pay minus Taxes
        	Display Gross Pay to the user
        	Display Taxes to the user
        	Display Net Pay to the user
        End If
        
      6. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      7. Extra Credit Format your output for currency

    30 10/18/07 Thursday - Math, Sub-Routines, "vbGrades2"
    1. Classroom Discussion -
      1. Math - Ms. Verde & Greatest Common Denominator (GCD) & Least Common Denominator (LCD)
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
    2. Lab Assignment -
      1. Re-write the "vbGrades" program to use sub-routines:
        1. Copy your existing "vbGrades" to "vbGrades2"
        2. Redesign the form for textbox input named "txtInput" & label output named "lblOutput"
        3. Variables:
          Option Explicit
          Dim sngNumberGrade As Single
          Dim strLetterGrade As String
          Dim intMsgRes As Integer
          Dim strResults As String
          Dim strMessage As String
          
        4. Pseudocode for command button object "Go":
          Populate variable sngNumberGrade using a function "getNumberGrade()"
          Populate variable strLetterGrade using a function "getLetterGrade()"
          Popluate variable strMessage using a function "getMessage()"
          Call a subroutine "displayResults()" to display the results
          
        5. Pseudocode for function "getNumberGrade()"
          If the input textbox is not numeric
          	Display a message for the user
          	Set the focus
          	Set variable "getNumberGrade" to -1 minus one
          else
          	Set variable "getNumberGrade" to the contents of the input textbox
          
        6. Pseudocode for function "getLetterGrade()"
          Use a case or nested if statement to assign variable "getLetterGrade"
          if sngNumberGrade >= 93 then getLetterGrade = "A"
          if sngNumberGrade >= 85 then getLetterGrade = "B"
          if sngNumberGrade >= 75 then getLetterGrade = "C"
          if sngNumberGrade >= 70 then getLetterGrade = "D"
          if sngNumberGrade >= 0 then getLetterGrade = "F"
          else getLetterGrade = "Oops"
          
        7. Pseudocode for function "getMessage()"
          Use a case or nested if statement to assign variable "getMessage"
          if strLetterGrade = "A" then getMessage = "Great work"
          if strLetterGrade = "B" then getMessage = "Almost there"
          if strLetterGrade = "C" then getMessage = "Keep on trying"
          if strLetterGrade = "D" then getMessage = "Ask for help"
          if strLetterGrade = "F" then getMessage = "Maybe try som other career"
          else getMessage = "Invalid input"
          
        8. Pseudocode for sub-routine "displayResults()"
          Populate variable strResults with some appropriate message like:
          	"A number grade of 95"
          	"Gets a letter grade of "A"
          	"Great Work"
          Display variable strResults to the output label caption
          Set the focus back to the input textbox
          
        9. Code for "GotFocus()"
          ' only works if your textbox is named "txtInput"
          Private Sub txtInput_GotFocus()
              txtInput.SelStart = 0
              txtInput.SelLength = Len(txtInput.Text)
          End Sub
          
        10. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        11. Extra Credit ???

    31 10/19/07 Friday - SkillsUSA, Sub-Routines, "vbGCF"
    1. Classroom Discussion -
      1. SkillsUSA - New Jersey website
      2. Greatest Common Factor (GCF) - The greatest common factor (GCF) is the greatest factor that divides two numbers
      3. Least Common Multiple (LCM) - The least common multiple (LCM) of two numbers is the smallest non-zero number that is a multiple of both
      4. Pass an argument as a parameter into a sub-routine or function:
        • Declare the parameters as variables inside the parenthesis
        • For example, a subroutine to display information, an integer number "n1" & a text string "s1":
          Private Sub CommandShowAge_Click()
          Call showage(17, "Your Age")
          End Sub
          
        • Call the sub-routine or function with values or variables inside the calling statement parenthesis, for example, 17 & "Your Age":
          Private Sub showage(n1 As Integer, s1 As String) As Integer
          MsgBox s1 & " is " & n1
          End Sub
          
        • Explanation:
          1. The number 17 is passed into the local variable "n1"
          2. The text string literal "Your Age" is passed into the local variable "s1"
          3. The message box displays "Your Age is 17"
          4. Sub-routines don't return a value to the calling statement
          5. Test it
        • Another example, a function to multiply two numbers:
          Private Sub Multiply_Click()
          Dim n1 As Integer
          Dim n2 As Integer
          Dim ans As Integer
          n1 = 5
          n2 = 7
          ans = mult2numbers(n1, n2)
          MsgBox n1 & " x " & n2 & " = " & ans
          End Sub
          
        • Since a function will return ONE AND ONLY ONE result, call a function by using it on the right side of an equals sign:
          Private Function mult2numbers(a As Integer, b As Integer) As Integer
          mult2numbers = a * b
          End Function
          
        • Explanation:
          1. The number 5 as "n1" is passed into the local variable "a"
          2. The number 7 as "n2" is passed into the local variable "b"
          3. The function performs the multiplication & assigns the answer to the function name
          4. When the function ends, the value of 35 is returned to the calling statement
          5. Test it
        • You may also call a function by using it inside another function:
          MsgBox n1 & " x " & n2 & " = " & mult2Numbers(n1, n2)
          
        • You may also call a function by using it as part of a Boolean comparison (decision or loop):
          If mult2numbers(n1, n2) > 20 Then
              MsgBox "Larger"
          Else
              MsgBox "Smaller"
          End If
          
      5. Important: A function will return ONE AND ONLY ONE result to the calling statement
      6. Doubly important: You MUST use the return from a function:
        1. On the right side of an equal statement
        2. Inside another sub-routine or function
        3. As part of a Boolean comparison (decision or loop)
      7. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
      8. Another Reference: wikiversity.org - Functions and Subroutines in VB6
    2. Lab Assignment -
      1. Create a VB program "vbGCF" to use sub-routines to calculate the Greatest Common Denominator between two user-supplied numbers:
        • Design the form as shown, two input textboxe objects named "txtNum1" & "txtNum2", one output label object named "lblOutput", & three command button objects named "cmdGCF", "cmdLCM", & "cmdExit"
        • Variables:
          Option Explicit
          Dim lngNum1 As Long
          Dim lngNum2 As Long
          Dim lngStopAt As Long
          Dim lngCount As Long
          Dim strOutput As String
          Dim lngGCF As Long
          Dim lngLCM As Long
          
        • Pseudocode for "Exit":
          Confirm that the user really wants to exit
          If yes, end
          
        • Pseudocode for "GCF":
          If txtNum1.text is a number
          	Populate variable intNum1 with the value in txtNum1.text
          End if
          If txtNum2.text is a number
          	Populate variable intNum2 with the value in txtNum2.text
          End if
          Call a sub-routine to find the GCF
          Call a sub-routine to displayOutput
          
        • Pseudocode for "findGCF":
          Populate variable intStopAt with the larger of intNum1 or intNum2
          Loop from 2 to half of intStopAt
          	If intNum1 is evenly divisible by the sentinel variable AND
          	If intNum2 is evenly divisible by the sentinel variable THEN
          		' Remember the sentinel as a possible GCF
          		Populate variable intGCF
          	End if
          End loop
          
        • Pseudocode for "displayOutput":
          Populate variable strOutput with appropriate content
          Display strOutput onto lblOutput.caption
          
        • Pseudocode for "LCM":
          If txtNum1.text is a number
          	Populate variable intNum1 with the value in txtNum1.text
          End if
          If txtNum2.text is a number
          	Populate variable intNum2 with the value in txtNum2.text
          End if
          Call a sub-routine to find the LCM
          Call a sub-routine to displayOutput
          
        • Pseudocode for "findLCM":
          Populate variable intStopAt with the product of intNum1 times intNum2
          Loop from intStopAt to 1 decrement by -1
          	If the sentinel is evenly divisible by both intNum1 AND intNum2 then
          		Populate variable intLCM with the sentinel value
          	End if
          End loop
          

    32 10/22/07 Monday - VB Functions, "vbPower"
    1. Classroom Discussion -
      1. Student Photos - 9:45 & 12:45
      2. Vocabulary:
        • Recursion - A method of defining functions in which the function being defined is applied within its own definition
        • Exponent - A number that indicates the operation of repeated multiplication
        • Power - A number that indicates the operation of repeated multiplication
        • math.com - explanation of exponents
      3. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 13 - Modular Programming
    2. Lab Assignment -
      1. Visual Basic Quiz 3. 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
      2. Create a Visual Basic program "vbPower.vbp" to raise a number to a power:
        • Design the form with three textbox objects: "txtNum", "txtExp", & "txtOut" & two command button objects "cmdGo" & "cmdExit"
        • Write the code for "cmdExit"
        • Variables:
          Option Explicit
          Dim intNum As Integer
          Dim intExp As Integer
          Dim lngAns As Long
          Dim strOut As String
          Dim blnOk As Boolean
          
        • Pseudocode for "cmdGo":
          Set variable "blnOk" to true
          Assign the result of function "getNum()" to variable "intNum"
          Assign the result of function "getExp()" to variable "intExp"
          if blnOk then
          	Assign the result of function "getAns(intNum, intExp)" to variable "lngAns"
          end if
          Call sub-routine "displayAns"
          
        • Pseudocode for function "getNum() as Integer":
          If "txtNum" is not a number
          	Display an appropriate error message
          	Set the focus
          	Set variable "blnOk" to false
          	Set the function to return a -1
          Else
          	Set the function to return the value in "txtNum"
          End if
          
        • Pseudocode for function "getExp() as Integer":
          If "txtExp" is not a number
          	Display an appropriate error message
          	Set the focus
          	Set variable "blnOk" to false
          	Set the function to return a -1
          Else
          	Set the function to return the value in "txtExp"
          End if
          
        • Pseudocode for function "getAns(n as Integer, e as Integer) as Long":
          If e - 1 then
          	Return n
          Else
          	Return the results of function "getAns(n, e - 1)"
          End if
          
        • Pseudocode for sub-routine "displayAns():
          If blnOk is true then
          	Build variable "strOut" as something like "Num raised to the power of Exp is Ans"
          Else
          	Build variable "strOut" as something like "Error on input, please try again"
          End if
          
        • Write the code to select the contentes of the input textbox objects on "gotFocus()"
        • Test with these numbers:
          number exponent answer
          3 3 27
          8 2 64
          2 8 256
          5 4 625
          4 5 1024
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive

    33 10/23/07 Tuesday - VB Functions, "vbNames"
    1. Classroom Discussion -
      1. Visual Basic Listbox Object
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 10 - List Boxes and Data Lists
    2. Lab Assignment -
      1. Create a Visual Basic program "vbNames.vbp" to work with the Listbox object
        • Design the form as shown
        • 2 textbox objects named "txtUserName" & "txtIndex" for input
        • 1 listbox object named "lstUserName" for output
        • 4 command button objects named "cmdExit" & "cmdAddUser" & "cmdClearName" & "cmdDisplayOne"
        • Code "cmdExit"
        • Pseudocode for "cmdAddUser":
          If validEntry() then
          	Add the value from the input textbox to the listbox
              Clear the input textbox "txtUserName"
              Set the focus to "txtUserName"
          End If
          
        • Pseudocode for function "validEntry()":
          If the input is blank then
          	Display an appropriate error message
          	Set the focus to the input
          	Return False
          ElseIf the input contains blank spaces
          	Display an appropriate error message
          	Set the focus to the input
          	Return False
          Else
          	Set the focus to the input
          	Return True
          End If
          
        • Pseudocode for "cmdClearNames:
          If vbYes then
          	Clear the user name listbox
          	Set the focus to the input
          End If
          
        • Pseudocode for "cmdDisplayOne":
          If "txtIndex.text" is not numeric then
          	Display an appropriate error message
          	Set the focus
          Else
          	Set variable "intIndex" to the value in textbox "txtIndex.text"
          	If variable "intIndex" is larger than the total number of items in the listbox then
          		Display an appropriate error message
          		Set the focus to "txtIndex"
          	Else
          		Display only that index item from the listbox in a message box
          		("lstUserName.List(intIndex)")
          		Set the focus to "txtIndex"
          	End If
          End If
          
        • After displaying the item from the listbox, clear the input & set the focus
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      2. Extra CreditWhen the user clicks on a username in the listbox, display a warning message, if the user answers "Yes", remove that one item from the listbox
      3. Extra CreditModify the Listbox program to include a list of passwords
        • Add another input textbox "txtPassword"
        • Add another listbox "lstPassword"
        • Both name & password may not be empty when using "cmdAddUser"
        • "cmdDisplayOne" must display both name & password in a single message box
        • Clear command button must clear both name & password listboxes

    34 10/24/07 Wednesday - Career, VB Functions, "vbStates" game
    1. Classroom Discussion -
      1. Guest Speaker - DeVry - 8:30 & 11:00 - Postponed
      2. Career - U.S. Federal Bureau of Labor Statistics website. The Bureau of Labor Statistics (BLS) is the principal fact-finding agency for the Federal Government in the broad field of labor economics & statistics
      3. Visual Basic Combobox Object
      4. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 10 - List Boxes and Data Lists
      5. Useful VB Combobox methods:
        • cboName.AddItem strItemName ' Add an item to the list
        • intIndex = cboName.ListIndex ' Save the index number of the item that was clicked
        • cboName.ListIndex = intIndex ' Select (highlight) the item using an index number
      6. Reading from a text file:
        • Must be in the same folder (save, close, open your VB project)
        • Name the file, close any open files, ensure the file exists & has data, open the file, like this:
    2. Lab Assignment -
      1. Programming Completer Pre-Exam. 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
      2. Create a Visual Basic program "vbStates.vbp" to list all 50 U.S. states in a Combobox:
        • Create a text file named "states.txt" with the names of all 50 U.S. states, Google search, copy & paste into notepad
        • Create a text file named "capitals.txt" with the names of all 50 U.S. capitals, Google search, copy & paste into notepad
        • Add a command button object & code to exit
        • Add a combobox object "cboStates" to contain the list of the states
        • Add a combobox object "cboCapitals" to contain the list of the capitals
        • Add a label object "lblOut" for output
        • Variables:
          Option Explicit
          Dim strLine As String
          Dim strFileName As String
          Dim strState As String
          Dim strCapitalReal As String
          Dim strCapitalPick As String
          Dim intIndex As Integer
          
        • Pseudocode for "Form_Load()", double-click any blank area of the form
          Populate the variable "strFileName" with the name of the text file "states.txt"
          Close any open files with "Close"
          If the text file is not empty then
          	Open the text file for input
          	While not end of file
          		Read 1 line of data into variable "strLine"
          		Add the value in variable "strLine" to the combobox "cboStates"
          	Loop
          End If
          Repeat for file "capitals.txt" & combobox "cboCapitals"
          
        • VB Code to open a non-empty text file for input:
          If LenB(Dir$(strFileName)) Then ' file is not empty data
          	Open strFileName For Input As #1 ' open the file
          End If
          
        • VB Code to loop while not end of file:
          Do While Not EOF(1)
          	' statements
          Loop
          
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Pseudocode for "cboStates_Click()":
          If the user clicks on a state then
          	Select the appropriate capital
          	Display an appropiate message on the output label
          End If
          
        • Pseudocode for "cboCapitals_Click()":
          If the user clicks on a capital then
          	Select the appropriate state
          	Display an appropiate message on the output label
          End If
          
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Add another combobox object named "cboCapitalsSorted", set the sorted property to True
        • Add a checkbox object named "chkPlay"
        • Modify the "Form_Load()":
          Set "cboCapitals.Visible" = True
          Set "cboCapitalsSorted.Visible" = False
          Set "cboCapitals.TabStop" = True
          Set "cboCapitalsSorted.TabStop" = False
          Set "chkPlay.Value" = vbUnchecked
          Set "cmdGuess.Visible" = False
          
        • Pseudocode for "chkPlay_Click()":
          If chkPlay.Value is vbChecked Then
              Set "cboCapitals.Visible" = False
              Set "cboCapitalsSorted.Visible" = True
              Set "cboCapitals.TabStop" = False
              Set "cboCapitalsSorted.TabStop" = True
              Set "cmdGuess.Visible" = True
          Else
              Set "cboCapitals.Visible" = True
              Set "cboCapitalsSorted.Visible" = False
              Set "cboCapitals.TabStop" = True
              Set "cboCapitalsSorted.TabStop" = False
              Set "cmdGuess.Visible" = False
          End If
          
        • Pseudocode for "cmdGuess_Click()":
          Populate variable "strState" with the selected item from "cboStates"
          Populate variable "strCapitalReal" with the selected item from "cboCapitals"
          Populate variable "strCapitalPick" with the selected item from "cboCapitalsSorted"
          If strCapitalReal = strCapitalPick Then
              Display an appropriate message on the output label caption
          Else
              Display an appropriate message on the output label caption
          End If
          
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra CreditIf the checkbox is clicked, don't display matching answers

    35 10/25/07 Thursday - English, OCC Information Session, VB Functions, "vbStates" game
    1. Classroom Discussion -
      1. Breast cancer awareness - wear pink
      2. OCC Information Session - 9:00 & 11:00
      3. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 11 - Additional Controls
      4. Lab Assignment -
        1. Finish the VB States game from yesterday to make it more game-like

    36 10/26/07 Friday - Skills USA, Visual Basic Quiz, "vbAreaPerimeter"
    1. Classroom Discussion -
      1. PDP Intro
      2. Visual Basic Quiz in lab
    2. Lab Assignment -
      1. Visual Basic Quiz 4. 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
      2. Quiz Part II - Design, write, create, test, run, & save a Visual Basic program called "vbAreaPerimeter" to display the area & perimeter of a rectangle
        • Perimeter is found as the sum of twice the length plus twice the width
        • Area is found as the product of length times width
        Review the formulas necessary: Design the form:
        • 2 input text boxes: one for height, one for width
        • A label with instructions
        • A label for the answers
        • Labels to identify all text boxes & any output labels
        • 2 command buttons: one for exit, one for calculate
        Guidelines:
        • Declare variables for height & width & area & perimeter
        • When the user clicks on exit, unload me
        • When the user clicks on calculate, calculate the area & perimeter & display the values
        • If the two input text boxes are numeric, convert the values & save into height & width variables
        • Multiply height times width & put the answer into area
        • Add height plus height plus width plus width & put the answer into perimeter
        • Display both answers with appropriate descriptive text on the form
        Finishing Up:
        • Test with the numbers given
          Height Width Area Perimeter
          3 4 12 14
          4 5 20 22
          5 5 25 20
        • If rectangle is a square, display some message saying so
        • If you have time remaining, make the form look good - colors - font face & size - object placement - organization
        • When all complete, copy the folder to your "Z:/toBeGraded/" folder so I can grade it
        Grading (total of 100 pts available):
        • Must give correct answers (75 pts)
        • Must use Option Explicit (5 pts)
        • Must use correct object & variable naming conventions (txtSomething & intSomething) (5 pts)
        • Must have at least one programmer-written function or sub-routine (5 pts)
        • Must have author name, program name, & date written as comments (5 pts)
        • Must look good (5 pts)
      3. If you complete "vbArea", modify it to add other shapes:
        These two-dimensional shapes can have perimeter & area values:
        • Circle
        • Triangle
        • Rectangle
        These three-dimensional shapes can have surface & volume values:
        • Sphere (ball)
        • Cone (ice-cream)
        • Triangle Pyramid (Tetrahedron with four equilateral triangle faces)
        • Rectangle Pyramid (Square base with four triangle faces)
        • Octahedron (8 equilateral triangle faces)
        Find the necessary formulas on the websites listed: Guidelines:
        • Modify the form with textboxes, labels, & command buttons
        • Add any variables you might need
        • Run the correct formulas
        • Display appropriate output messages with your answers

    37 10/29/07 Monday - Vocabulary, VB Option Buttons, "vbPong"
    1. Classroom Discussion -
      1. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 11 - Timer Object
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 18 - Image Object
      3. Pong - the first-ever computer video game:
    2. Lab Assignment -
      1. Create a Visual Basic program "vbPong.vbp", our own version of the first-ever computer video game:
        • Create a new VB executable
        • Name the form "pong" & change the caption to "Pong -The First-Ever Computer Video Game"
        • Find a ball-shaped image online (I'll copy mine to the "Q:/pcProgramming/vbExamples" folder)
        • Add an image object named "imgBall"
        • Add two (2) line objects named "linLeft" & "linRight"
        • Add two (2) label objects for score output named "lblLeft" & "lblRight"
        • Add a timer object named "tmrBall"
          • The timer interval property is measured in milliseconds
          • There are 1000 milliseconds in a computer second
          • To get the timer event to execute 10 times every second, 1000 clicks per second divided by 100 is 10 times
        • NO NO NO == Add & code an exit command button object "cmdExit" == NO NO NO
          KeyPress doesn't work if you have ANY command button objects
        • Variables:
          Option Explicit
          Dim blnMoveUp As Boolean
          Dim blnMoveLeft As Boolean
          Dim intScoreLeft As Integer
          Dim intScoreRight As Integer
          
        • Pseudocode for Form_Load():
          Set the form backcolor
          Set the initial ball left property position to 199
          Set the initial ball top property position to 199
          Load the ball image into the ball picture property
          Set the timer interval property to 100
          Set the variable blnMoveUp to False
          Set the variable blnMoveLeft to False
          
        • Test
        • Movement:
          • Move the ball to the right by increasing the left property
          • Move the ball to the left by decreasing the left property
          • Move the ball down by increasing the top property
          • Move the ball up by decreasing the top property
        • Test
        • Experiment with both "tmrBall.interval" & "imgBall.left" to get the smoothest movement
        • Switch the ball movement whenever the ball "touches" an edge of the form:
        • Pseudocode for moving ball left, right, up, & down:
          If ball.left < 0 Then
          	Increment score right
          	Display right score
          	Move ball right
          ElseIf ball.left + ball.width > form.width Then 
          	Increment score left
          	Display left score
          	Move ball left
          End If
          If ball.top < 0 Then move ball down
          If ball.top + ball.height > form.height Then move ball up
          
        • Test
        • Add two line objects named "linLeft" & "linRight"
        • Modify the Form_Load():
          ' X1,Y1 is the top point of a line
          ' X2,Y2 is the bottom point of a line
          Set the left line "X1" property to 100 from the left side of the form
          Set the left line "Y1" property to 0 to match the form top
          Set the left line "X2" property to 100 from the left side of the form
          Set the left line "Y2" property to 1000 to make the line 1000 twips long
          Set the right line "X1" property to the form width - 200
          Set the right line "Y1" property to 0 to match the form top
          Set the right line "X2" property to the form width - 200
          Set the right line "Y2" property to 1000 to make the line 1000 twips long
          
        • Locate the Form_Load() code & select "KeyPress" from the top-right dropdown menu
        • We can move the paddles (left & right line objects) by pressing on keys
        • We have to move both "Y1" & "Y2" at the same time
        • Keep "Y2" the same distance from "Y1"
        • Pseudocode for Form_KeyPress(KeyAscii As Integer):
          If the user presses key #27 ("esc") then end
          If the user presses key #101 ("E") then move the left paddle up 200
          If the user presses key #100 ("D") then move the left paddle down 200
          If the user presses key #105 ("I") then move the right paddle up 200
          If the user presses key #107 ("K") then move the right paddle down 200
          
        • Test
        • If the ball hits either left or right paddle, change the direction, pseudocode:
          If the ball is moving left AND 
          	the left side of the ball is further less than the left paddle X1 AND 
          	the middle of the ball (ball top + 1/2 ball height) is greater than the top of the left paddle Y1 AND 
          	the middle of the ball is less than the bottom of the left paddle Y2 THEN
          	Change the ball direction
          ElseIf the ball is moving right AND 
          	the right side of the ball is further greater than the right paddle X1 AND 
          	the middle of the ball (ball top + 1/2 ball height) is greater than the top of the right paddle Y1 AND 
          	the middle of the ball is less than the bottom of the right paddle Y2 THEN
          	Change the ball direction
          End If
          
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra CreditAdd a feature to end play when either player reaches a score of 5 points
        • Extra CreditAdd a reset button & code
        • Extra CreditChange the image from a smiley face to a frowny face when the image hits either wall
        • Extra CreditChange the image each time the image changes direction (left or right)

    38 10/30/07 Tuesday - English, Finish "vbPong"
    1. Classroom Discussion -
      1. Ms. Gerick & Career Focus Interest Inventory - Don't take this until Ms. Gerick tells you to
    2. Lab Assignment -

    39 10/31/07 Wednesday - Happy Halloween - Career, VB Scrollbars, "vbQuotes"
    1. Classroom Discussion -
      1. Review learning styles from Chaminade College Preparatory School
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 10 - Data Arrays
      3. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 11 - Scrollbars
      4. Lab Assignment -
        1. Why take a completer exam before we learn?
          • Compare your Fall score with your Spring score to discover how much you've learned
          • Comprehend your opportunity to enrich your knowledge by being present & paying attention
          • Receive the points you achieve as extra credit
          • Anybody who achieves a 93% or above will receive an "A" for the course & is not required to complete any labs (attendance is still required)
          • The database failed, take the test again
          • Programming Completer Pre-Exam. 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
        2. Take both of the following online learning styles assessments & write down your learning styles
          • University of Arizona
          • Record your answers in a table like this: (Here's what I got)
            ArizonaU
            Visual 45
            Auditive 17
            Kinestetic 45
          • Now that you know how you learn best, will you change the way you study?
        3. Create a Visual Basic program "vbQuotes" project to display various famous quotes with the user using scrollbars:
          • How it works:
            1. The program pre-loads 5 famous quotes into an array variable
            2. The user changes the scroll bar
            3. The scroll bar value property determines which quote is displayed on an output label
          • Design the form:
            1. A title
            2. A horizontal scroll bar object named "hsbQuote" with these initial properties:
              • Min = 1
              • Max = 20
              • SmallChange = 1
              • LargeChange = 1
            3. An output label object named "lblNum" to display the value of the scroll bar
            4. An output label object named "lblOut" to display the quote selected
            5. An exit command button object named "cmdExit" to exit
          • Global Variables:
            Option Explicit
            Dim strQuote(20) As String
            
          • Pseudocode for "Form_Load()":
            Load string literals into each quote ' strQuote(1) = "First Quote"
            Display the number 1 onto "lblNum" ' lblQuoteNumber.Caption = 1
            Display the first quote onto "lblOut" ' lblOut.Caption = strQuote(1)
            
          • Pseudocode for "hsbQuote_Change()":
            Place the current scroll bar value onto "lblNum" ' lblNum.Caption = hsbQuote.Value
            Place the current quote onto "lblOut" ' lblOut.Caption = strQuote(hsbQuote.Value)
            
          • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
          • Extra CreditUse option (radio) buttons to control quote colors
          • Extra CreditUse option (radio) buttons to control font names
          • Extra CreditUse option (radio) buttons to control font styles (bold & italic)
          • Extra CreditUse another scroll bar to control font size
        4. Modify your distance and/or temperature converter programs to use scrollbars to input the distance or temperature
        5. Complete any unfinished assignments

    40 11/01/07 Thursday - DeVry, Completer Pre-Exam, modify "vbQuotes", modify "vbTrafficLight"
    1. Classroom Discussion -
    2. Lab Assignment -
      1. Why take a completer exam before we learn?
        • Compare your Fall score with your Spring score to discover how much you've learned
        • Comprehend your opportunity to enrich your knowledge by being present & paying attention
        • Receive the points you achieve as extra credit
        • Anybody who achieves a 93% or above will receive an "A" for the course & is not required to complete any labs (attendance is still required)
        • The database failed, take the test again
        • Programming Completer Pre-Exam. 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
      2. Modify your "vbQuotes" project to allow the user more control by using timers
        • Add a timer object named "tmrQuote" that will automatically change the quote after a set amount of time has expired
        • Set the timer interval to 5000 ticks
        • Write the code for the timer object to call the next quote command button when the time expires
        • Save & Test
        • Change the timer enabled property to False
        • Add a checkbox object "chkTimer" & code to enable the timer when checked
        • Save & Test
        • Add a variable "intTimer" started at 5 that will count down to changing the quote
        • Add a label "lblTimer" to display the "intTimer"
        • Change the timer interval to 1000 ticks
        • Change the code inside the timer object to test the value of "intTimer", if intTimer <= 0 then call the next quote command button & set "intTimer" back to 5, else decrement "intTimer"
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra CreditThink up & do something I didn't think of
      3. Modify your "vbLight" traffic light program to automatically change the lights, say 20 seconds red, 15 seconds green, & 5 seconds yellow
      4. Complete any unfinished assignments

    41 11/02/07 Friday - Daylight Saving Time Ends Sunday, SkillsUSA, "vbImageDisplayer2"
    1. Classroom Discussion -
      1. Daylight Saving Time - Remember to change your clocks
    2. Lab Assignment -
      1. Create a VB program "vbImageDisplayer2" to display a series of images using an image, a timer, a scrollbar, & a checkbox:
        • Open VB, make a new executable, name the form, save into a folder, & close VB
        • Open Windows Explorer ("My Documents" or "My Computer"), browse to the folder, & open the project by double-clicking
        • Add & code an Exit command button object
        • Add an image or picture object to display your images
        • Search for & copy about 10 images off the internet & save them into the correct folder
        • Load the names of the images from a text file into a data array variable so you can display them in a timer loop
        • Add & code a timer object to control switching the image automatically
        • WARNING - Be careful to not let the index to the data array go down past zero or up past the maximum number of images used
        • Add & code a scrollbar object to control the timer interval, how long an image is displayed before it switches
        • Add & code a checkbox object to control whether the timer is enabled True or False
        • Add & code a label object to display the name of the current displayed image
        • Save & test
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
        • Extra CreditAdd objects for "Back" & "Forward" buttons & allow the user to select whether to use the auto-timer or the buttons
      2. Complete any unfinished assignments

    42 11/05/07 Monday - Visual Basic Quiz, "vbOhmsLaw", "vbSnake"
    1. Classroom Discussion -
      1. Check your grades - if you haven't completed an assignment, you may complete it this week
      2. Online VB6 Text: Sams Teach Yourself Visual Basic 6 - Chapter 18 - Animating Pictures
      3. the12volt.com - Formulas for Ohm's Law
      4. msdn2.microsoft.com - Visual Basic Math Functions
    2. Lab Assignment -
      1. Visual Basic Quiz 5. 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
      2. Quiz Part II - Design, write, create, test, run, & save a Visual Basic program called "vbOhmsLaw" to allow the user to calculate the Power laws:
        • Open Visual Basic & create a new executable
        • Name the form "frmOhmsLaw" & name the project "vbOhmsLaw"
        • Design the form to let the user choose which calculation to use
        • Design the form to let the user input 2 numbers
        • Process the correct calculation(s) & display the answer(s)
        • Use the pre-defined, built-in, VB function dblAns = Math.Sqr(dblNum) to calculate square roots
        • Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive

    43 11/06/07 Tuesday - "vbSnake" cont'd
    1. Classroom Discussion -
      1. F I N A L L Y ! ! ! the grades spreadsheets is done:
        • Navigate to your "Z:/Grades" folder
        • Double-click the "css##.csv" (comma-separated-variable) file using Microsoft Excel
        • Review the file for assignments due & completed
        • The top left 5 rows & 3 colums have your name, css##, & summary grade
        • Columns "A" through "D" are lab assignments (1/3 of total grade)
        • Column "A" is the date an assignment was assigned
        • Column "B" is the assignment name
        • Column "C" (Points Assigned) is the max points you can receive for any assignment
        • If Column "C" is blank, the assignment is extra credit
        • Column "D" (Points Achieved) is the grade you received for the assignment
        • If Column "D" is blank, either you haven't completed the assignment or I haven't graded it
        • Column "D" is usually ranked on a scale of 0 to 100 with 75 being average
        • Columns "B" through "D" rows 106 through 110 show any extra credit received, assignments due & completed
        • You may complete & hand-in (toBeGraded) any incomplete or ungraded assignment up until the end of the marking period
        • Columns "E" through "H" are attendance/participation (2/3 of total grade)
        • Column "E" is the date
        • Column "G" (Attendance Assigned) is the max points you can receive for any attendance/participation
        • If Column "G" is blank, no points available, usually means school closed
        • Column "H" (Attendance Achieved) is the grade you received for the attendance/participation
        • Columns "H" through "H" are attendance/participation (2/3 of total grade)
        • Column "H" is on a scale of 0 to 4, blank or 0-absent, 1-present but no participation, 2-present with some participation, 4-present with total participation
        • In Column "H" an "x" means excused absence, with 4 extra points given in leu of actual attendance
        • Columns "F" through "H" rows 63 through 67 show attendance/participation summary
        • Any questions?
    2. Lab Assignment -
      1. Create a Visual Basic program "vbSnake" to play the famous cell phone game:
        1. Rules:
          1. The "snake" will start with a length of 5
          2. The "snake" will start moving at 10 spaces each second (timer interval = 100)
          3. The "food" will appear randomly & last for 5 seconds
          4. Each time the "snake" eats the "food" ("snake-head" top & left equal "food" top & left) the "snake" grows & adds 5 additional segments
          5. The length of the "snake" will never exceed 50 segments
          6. The speed will appear to increase when the "snake" feeds (decrease timer interval)
          7. The speed will never exceed light-speed
          8. The game ends when the "snake" encounters a wall ("snake-head" top & left pass outside the game field)
          9. The game ends when the "snake" encounters part of its own body ("snake-head" top & left equal part of the "snake" body)
          10. The number of "foods" the "snake" has eaten will appear on a label on the form
        2. Create a new Visual Basic executable
        3. Design the form with sufficient controls & objects
          1. Add a Shape object "shpBoard" for the game board
          2. Add a Shape object "shpHead" for the head of the snake
          3. Add a Shape object "shpFood" for the food
          4. Add a Timer object "tmrHead" to control snake head movement
          5. Add a Label object "lblScore" to display the score
          6. Add a Label object "lblFoodTime" to display the food time
        4. Write the code
          1. In the Form_Load(), set the board, snake head, & food initial height/width sizes & top/left positions
          2. Remember - in order to make it look good, start the snake head at a multiple of the width & height of the snake head: if the snake head is 250 wide & 250 high, start the snake head at 1000 & 1000
          3. Remember - in order to make it look good, move the snake in multiples of the snake head width & height: 250
          4. Use an integer variable "intDir" to keep track of direction (1=up, 2=down, 3=left, 4=right)
          5. On keyDown, use a Select Case to determine which key was pressed & change direction variable:
            • 56 is up (8) on the number keypad
            • 50 is down (2) on the number keypad
            • 52 is left (4) on the number keypad
            • 54 is right (6) on the number keypad
          6. In the food timer:
            • Randomly place food on board
            • Keep the food visible for 10 seconds
            • Whenever the snake head overlaps the food (.top & .head) it is considered eaten
            • Move uneaten food to another location every 10 seconds
          7. In the snake head timer:
            1. Use a Select Case to control direction
            2. Test for snake head overlap food & increment score & display score & move food & restart food timer
            3. Test for snake head position on board or over board
        5. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive
      2. Complete any unfinished assignments

    44 11/07/07 Wednesday - "vbSnake" Cont'd
    1. Classroom Discussion -
    2. Lab Assignment -
      1. Visual Basic program "vbSnake", cont'd
        1. Use "My Documents" or "My Computer" to navigate to & open your existing Visual Basic "vbSnake" program
        2. Copy the snake head & name it "shpTail"
        3. Copy the snake tail & paste it creating a Control Array of "shpTail()", create a total of 50 tail segments
        4. In the Form_Load(), in a loop, reset all "shpTail(i)" top/left/width/height/shape/visible properties
        5. Add a variable "intTailLength" to control the length of the tail & initialize it to 5 in the Form_Load()
        6. In a loop at the end of the timer, set top/left of each active (visible) tail segment to the top/left of the previous tail segment. When the snake head is moving, the tail will follow it like a centipede tail follows the centipede head -- snaking forward
        7. If the snake head hits one of the tail segments, game over
        8. When the snake head eats food, increment the tail length by 5 & decrement the timer interval by 20
        9. Test & Save frequently  Save to your "My Documents" folder & copy to your "Z:" drive & copy to your "Z:" drive
      2. Complete any unfinished assignments

    11/08/07 Thursday - OCVTS School Closed - NJEA Convention
    11/09/07 Friday - OCVTS School Closed - NJEA Convention

    45
    46
    47
    48
    49

    webopedia
    webster
    whatis
    vocabulary