|
|
Click for Instructions
Click on the date to open the details.
Click date again to close the details.
|
| Day |
Date |
|
Discussion
|
|
09/05/05 |
|
Monday - Labor Day Holiday
--
Send e-mail to Mr. Clarke before school starts
asking for Extra Credit and receive Extra Credit!!! |
|
09/06/05 |
|
Tuesday -
OCVTS School Closed - Teacher's Preparation Day |
| 1 |
09/07/05 |
|
Wednesday - Classroom Rules - Welcome
to Computer Science |
|
- Classroom Discussion -
- Message from Principal - read, sign, &
return
- Emergency Cards - fill out completely and
return
- Computer Contract - read, sign, & return
- Social Security Numbers - fill out completely
and return, required because the computers we're using were purchased
with federal grant monies
- Consent Form - for publications purposes
- Student Handbook & School Rules -
guidelines for a successful year
- Cell Phones/Beepers/Pagers - NJ State Statute ANN. 2C:33-19
prohibits students to bring or possess at any time on school property
- Smoking - NJ State Statute 26:3D-17
prohibits smoking anywhere in school buildings or on school grounds
- Grading Policy - 1/3 attendance &
participation, 2/3 tests, quizes, lab assignments
- Notebooks - handouts, returned assignments,
notes
- Discipline Policy - rules & regulations
- Dress Code - no offensive clothing, no hats
- CD Players, etc. - not required for classroom
activities
- Large Sums of Money - not required for
classroom activities
- Driving Policy - students may not drive
without prior approval from the Principal
- Safety - guidelines
- Fire Drills - exit route and outside meeting
place
- School Lockdown Procedures - student response
to emergencies
- Attendance - manditory (you can't learn if
you're not here)
- Hall Passes - ask teacher for permission to
leave classroom
- Bathroom Passes - ask teacher for permission
to leave classroom
- Computer Science Pre-Test - later this week
- School/Community Service Project - voluntary
- Food & drink - not allowed in classroom
- Student Grievance Procedures - posted on
board
- Skill Profiles - posted on board
- Student "CSS##" ID numbers
- Lab Assignment -
- Review classroom rules
- Forms to complete and return to teacher:
- Message from Principal - student signature
- Emergency Card - student fills out
- Computer Contract - student and
parent/guardian signatures
- Social Security Number - student signature
- Consent Form - parent/guardian signature
- Research "History of Computing" online, take
notes, bookmark the best sites, and be prepared to participate in
classroom discussion tomorrow
- Contact information - send "mclarke@mail.ocvts.org" an e-mail from
your e-mail address
- Contact AIM contact name - add "compSciClarke" to
your contacts
- Guidelines to Add New Printer:
- Click "Start"
- Click "Printers and other hardware"
- Identify any existing printers (HP LJ5) and
(Tektronix)
- If they both exist, simply close the
printers window, otherwise, continue:
- Click "Add a Printer" to open the Printer
Wizard
- Read the Welcome Message and Click "Next"
- Our printers are Network Printers, click
that button, and click "Next"
- Search for printers
- Click "HP LJ5" and click "Next"
- Click "Finish" to add the printer
Repeat for the "Tektronix" printer
|
| 2 |
09/08/05 |
|
Thursday - Classroom Rules, Computer
IDs, & History of Computer Hardware |
|
- Classroom Discussion -
- Review yesterday
- History of Computing
- Lab Assignment -
- Review classroom rules
- Forms to complete and return to teacher:
- Message from Principal - student signature
- Emergency Card - student fills out
- Computer Contract - student and
parent/guardian signatures
- Social Security Number - student signature
- Consent Form - parent/guardian signature
- Research "History of Software" online, take
notes, bookmark the best sites, and be prepared to participate in
classroom discussion tomorrow
- Contact information - send "mclarke@mail.ocvts.org" an e-mail from
your e-mail address
- Contact AIM contact name - add "compSciClarke" to
your contacts
|
| 3 |
09/09/05 |
|
Friday - Classroom Rules, History of
Software, Intro to Visual Basic, "vbHelloWorld" |
|
- Classroom Discussion -
- Review School Rules
- History of Software:
- Computer System:
- Hardware: System Box, Keyboard, Mouse,
Monitor, Printer, etc.
- Software: Operating System &
Applications Software
- People: Requried to input data and
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 and 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, and production of documents and texts by means of
computer systems
- Spreadsheet: An accounting or bookkeeping
program that displays data in rows and columns on a screen
- Database: Programs to ease the collection
of data arranged for ease and speed of search and 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 and
receiving messages
- Software Developers use Programming
Languages to create both Operating Systems and Applications
Software:
- Source Code: Before interpreting or
compiling: Code written by a programmer in a high-level language
and 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 and 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.
- 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
- Lab Assignment -
- Review classroom rules
- Forms to complete and return to teacher:
- Message from Principal - student signature
- Emergency Card - student fills out
- Computer Contract - student and
parent/guardian signatures
- Social Security Number - student signature
- Consent Form - parent/guardian signature
- Research "Word Processing" and "Microsoft Word
Tutorial" online, take notes, bookmark the best sites, and be prepared
to participate in classroom discussion Monday
- Create a Visual Basic program "HelloWorld":
- Open VB & create a new, standard.exe
- Save the form as "frmHelloWorld.frm" and
save the project as "vbHelloWorld.vbp", both into your "My
Documents/vb" folder
- Name the form "frmHelloWorld"
- Add a Textbox object and name it
"txtHelloWorld"
- Change the Text property to "Hello World!"
- Change font sizes as desired
- Change background and foreground colors
- Save frequently
- Test and debug your program (call me for
assistance)
- Contact information - send "mclarke@mail.ocvts.org" an e-mail from
your e-mail address
- Contact AIM contact name - add "compSciClarke" to
your contacts
|
|
| 4 |
09/12/05 |
|
Monday - History of Software, Visual
Basic Label, Textbox, & CommandButton objects, "vbAge" |
|
- Classroom Discussion -
- Parental/Guardian signed forms due: no computer contract = no computer
use
- Review Software History from Friday
- Some Definitions:
- Program: A sequence of instructions that a
computer can interpret and 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 and the most efficient
method of obtaining this end
- Writing a good program is the act of taking
a large problem and continually splitting it into smaller and
smaller sub-problems unti you reach a point where each sub-problem
requires one solution and is easy to program
- These smaller programs are called
"sub-procedures", sub-routines" or "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 and runs
but gives incorrect results
- Computer User: A person who uses computers
for work or entertainment or communication or business. Most users
lack full unserstanding 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]!!!
- Lab Assignment -
- Take the School Rules Quiz. Click the
link and follow the instructions. You MUST score 100% on this quiz.
- Create a Visual Basic program "Age":
- Open VB & create a new, standard.exe
- Save the form as "frmAge.frm" and save the
project as "vbAge.vbp", both into your "My Documents/vb" folder
- Name the form "frmAge", change the caption
to "Given your age, calculate your year of birth"
- Add a Label object, name it "lblTitle",
change the caption to "Instructions: Enter your age in the age box
and click GO to calculate your year of birth"
- Add a Label object, name it "lblAge",
change the caption to "Age"
- Add a Textbox object, name it "txtAge",
change the caption to ""
- Add a CommandButton object, name it
"cmdGo", change the caption to "&Go", change the default
property to "True"
- Add a Label object, name it "lblYear",
change the caption to "Year of Birth"
- Add a Textbox object, name it "txtYear",
change the caption to ""
- Add a CommandButton object, name it
"cmdExit", change the caption to "e&Xit", change the cancel
property to "True"
- Double-click the CommandButton object
"cmdExit" and enter "End". This programming instruction, when
clicked, will cause the program to stop running
- Double-click the CommandButton object
"cmdGo" and enter "txtYear.Text = 2005 - txtAge.Text". This
programming instruction, when clicked, 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 2005
- Center the instructions across the top of
the form
- Change font sizes as desired
- Change background and foreground colors
- Save frequently
- Test and debug your program (call me for
assistance)
|
| 5 |
09/13/05 |
|
Tuesday - Putting Code into Visual
Basic, Image Object, "vbTrafficLight" |
|
- Classroom Discussion -
- Parental/Guardian signed forms due: no computer contract = no computer
use
- Review Definitions from Monday
- Review Chapters 1-4 from Free-Ed.Net on Visual Basic
- Discuss Chapter 5 from Free-Ed.Net on Visual Basic, "Putting Code
into VB"
- Discuss the Image object and it's properties
- Lab Assignment -
- Take the School Rules Quiz. Click the
link and follow the instructions. You MUST score 100% on this quiz.
- Create a simple VB program to display a
traffic light image. Provide the user with three command buttons
"Stop", "Caution", and "Go". These buttons will control which of three
images will display in the form on the screen:
- Use Microsoft Paint to create three image
files called "Stop.bmp", Caution.bmp", "Go.bmp"
- Save these to your "My Documents/vb" folder
Some ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmTrafficLight.frm" and "vbTrafficLight"
- Name the form "frmLight"
- Add an image object to the center of your
form
- Name the image object "imgLight"
- Change the size to make it twice as high as
it is wide
- Save frequently
- Add a command button.
- Name the command button "cmdStop"
- Change the caption to read "Stop"
- Double-Click the "cmdStop" command button to
open the code window
- Add this line: "imgLight.Picture =
LoadPicture("Stop.bmp")"
- If your files are stored in another folder,
change the folder path
- Save frequently
- Add another command button for "Caution",
change the name, change the caption, add the code
- Save frequently
- Add another command button for "Go", change
the name, change the caption, add the code
- Save frequently
- Add a label named "lblInstructions" with a
caption instructing the user to press the buttons to see the light
change
- Save frequently
- Add another command button for "Exit"
- Name the Command Button "cmdExit"
- Change the Command Button caption to
"e&Xit"
- Change the Cancel property to "True" for the
excape key
- Double-Click the Command Button to open the
Code Window
- Add "End" after the subroutine title
cmdExit_Click() line and before the End Sub line
- Save frequently
- Use menu bar options "Run", "Start" to test
your program
- Save frequently
- Test and debug your program (call me for
assistance)
- Figure out how to
display the stop light when the program starts before the user
presses any buttons
|
| 6 |
09/14/05 |
|
Wednesday - Visual Basic Practice with
Image, Label, Textbox, and Command Button Objects, "vbImageDisplayer",
"vbTextDemo", "vbRailDemo" |
|
- Classroom Discussion -
- Parental/Guardian signed forms due: no computer contract = no computer
use
- Online textbook Free-Ed.Net on Visual Basic
- Nothing new, just practice with VB Image,
Label, Textbox, and Command Button objects. See how much you can do
without asking for my assistance, but ask for assistance when you need
it
- Lab Assignment -
- Take the School Rules Quiz. Click the
link and follow the instructions. You MUST score 100% on this quiz
- Create a simple VB program to display images
two ways, normal and stretched:
- Windows contains a large number of bitmap
and other graphics files
- Use a text box into which the user enters
the name of a graphical image
- When the user clicks a command button,
display the selected graphics file in two Image objects
Some
ideas:
- Start Visual Basic
- Save as "frmImageDisplayer.frm" and
"vbImageDisplayer.vbp" to your "My Documents/VB" folder
- Rename the Form to "frmDisplayer"
- Resize the Form to about twice as wide as it
is high
- Change the caption property to read "John
Doe's Image Displayer", but use your name
- Add a Label object named "lblImageFileName"
and change the caption property to something like "Enter File Name:"
- Add a Textbox object named
"txtImageFileName" and change the text property to be blank
- Add two Image objects, the first on the
left, the second on the right
- Name the first Image object "imgLeft" and
the second "imgRight"
- Make both Image objects the same size and
large
- Change the stretch property for imgRight to
"True"
- Add a Command Button object named
"cmdDisplay" and change the caption property to "&Display"
- Set this Command Button to run when the
"Enter" key is pressed
- Double click the "cmdDisplay" command button
and 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
- Add a Command Button object named "cmdExit"
and change the caption property to "e&Xxit"
- Set this Command Button object to run when
the "Escape" key is pressed
- Write the code for the "Exit" button
- Save frequently
- Test and debug your program (call me for
assistance)
- SAVE
FREQUENTLY
- Figure out how to make
the text window a dropdown menu with all the images in a folder
listed
- Create a VB program to demonstrate how text
can be moved to different control instances on a form:
- When the user clicks on button 1, copy the
caption from button 1 to the caption of label 1 and the text of text
box 1
- When the user clicks on button 2, copy the
caption from label 2 to the text of text box 2
- When the user clicks on button 3, copy the
text from text box 3 to the caption of label 3
Some ideas:
- Open VB & create a new, standard.exe
- Save to your "My Documents/vb" folder as
"frmTextDemo.frm" and "vbTextDemo.vbp"
- Create a form with three labels, three text
boxes, and three command buttons
- Name the form "frmTextDemo"
- Arrange the objects so they look good
- Name the form "frmTextDemo" and change the
caption to something appropriate
- Name the first text box "txt1" and change
the text to read "Text Box 1"
- Name the second text box "txt2" and change
the text to read "Text Box 2"
- Name the third text box "txt3" and change
the text to read "Text Box 3"
- Name the first label "lbl1" and change the
caption to read "Label 1"
- Name the second label "lbl2" and change the
caption to read "Label 2"
- Name the third label "lbl3" and change the
caption to read "Label 3"
- Name the first command button "cmd1" and
change the caption to read "Button 1"
- Name the second command button "cmd2" and
change the caption to read "Button 2"
- Name the third command button "cmd3" and
change the caption to read "Button 3"
- Double click the first command button and
add this code:
lbl1.Caption = cmd1.Caption
txt1.Text = cmd1.Caption
- Double click the second command button and
add this code:
txt2.Text = lbl2.Caption
- Double click the third command button and
add this code:
lbl3.Caption = txt3.Text
- Add an Exit command button, change the name
and caption. Use the "&" to make a hotkey. Make it so the
"escape" key will activate the Exit event. Double click the Exit
command button and add the code to "End" the program
- Use the techniques you learned over the past
couple of days
- Save frequently
- Test and debug your program (call me for
assistance)
- What would happen if
the user changed the text in text box 2 and then clicked on command
button 2? Test your thesis
- Create a VB program to simulate a railroad
train schedule:
- Design a form that would allow the user to
choose between displaying "Morning", "Afternoon", or "Evening" train
schedules
- The information to be displayed would be
"Scheduled Departure Time", "Track Number", and "Train Status"
- Leave room to display up to five trains
Some ideas:
- Open VB & create a new, standard.exe
- Save to your "My Documents/vb" folder as
"frmRailDemo.frm" and "vbRailDemo.vbp"
- Name the form "frmRailDemo"
- Add a Command Button object for "Exit",
write the code, make the "Escape" key work
- Math time -- you need three labels (Time,
Track, and 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.
- Make the "Border Style" property for all
Label objects "Fixed Single" so that they look like unchangable
Textbox objects
- 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
- Write similar code for the "Afternoon" and
"Evening" Command Button objects
- Save frequently
- Test and debug your program (call me for
assistance)
- - Make one of the
"Afternoon" blank and have only four trains
- 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:
- Open "Windows Explorer" or "My Documents"
and navigate to "H:"
- Create a sub-folder "VB"
- COPY all of your Visual Basic files
(everything) from "My Documents/VB" to "H:/VB"
- Every
day, after your work is complete, copy the most recent files to the
proper folder on the "H:" drive
|
| 7 |
09/15/05 |
|
Thursday - Visual Basic and Variables,
"vbVariableDemo" |
|
- Classroom Discussion -
- Parental/Guardian signed forms due: no computer contract = no computer
use
- Discuss Chapter 5 from Free-Ed.Net on Visual Basic,
"Lesson 5 - Putting Code into VB"
- Discuss:
- Lab Assignment -
- Take the School Rules Quiz. Click the
link and follow the instructions. You MUST score 100% on this quiz.
- Create a simple VB program to test data type
mixups:
- Assign a real number to an integer variable
& display the integer variable in a label caption
- Assign an integer number to a real variable
& display the integer variable in a label caption
Some
ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmVariableDemo.frm" and "vbVariableDemo"
- Name the form
- Add code for two global variables at the top
of the code window:
Dim sngNum As Single
Dim intNum As Integer
- Add a command button and code and "cancel"
for exit
- Add a text box for input "txtInput"
- Add a label for output "lblOutput"
- Add a command button and code for
RealInteger
intNum = txtInput.Text
lblOutput.Caption = intNum
- Test with a real number, like "2.5". Is the
output real or integer?
- Add a command button and code for
IntegerReal
sngNum = txtInput.Text
lblOutput.Caption = sngNum
- Test with an integer number, like "7". Is
the output real or integer?
- Save frequently
- Test and debug your program (call me for
assistance)
- What happens if you
enter a word or a date?
- Create a VB program to perform common distance
conversions:
- Inches to Centimeters
- Centimeters to Inches
- Feet to Meters
- Meters to Feet
- Miles to Kilometers
- Kilometers to Miles
For your
conversion numbers:
- 1 inch = 2.54 centimeters
- 1 centimeter = 0.4 inches
- 1 foot = 0.305 meters
- 1 meter = 3.28 feet
- 1 mile = 1.6 kilometers
- 1 kilometer = 0.625 miles
Some
ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmDistanceConverter.frm" and
"vbDistanceConverter"
- Add a textbox for input
- Add a label for output
- Add instructions to the user
- Add and name a command button for each
conversion
- Here's the general steps for each button:
- Assign the input text into a variable
- Calculate the answer
- Assign the answer to the output label
caption
- For example, Inches to Centimeters, if you
use these variable names:
dblInput = txtInput.text
dblOutput = dblInput * 2.54
lblOutput.caption = dblOutput
- Add a command button and code and "cancel"
for exit
- Save frequently
- Test and 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
- Add some other useful
distance conversions
|
| 8 |
09/16/05 |
|
Friday - Visual Basic Review and Quiz,
"vbTemperatureConverter" |
|
- Classroom Discussion -
- Parental/Guardian signed forms due: no computer contract = no computer
use
- Next week my AM class is assigned the pledge
and morning announcements - any volunteers?
- 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 and
spell any and all variables -- a great programming technique
- Variable Naming Convention:
- Must start with a letter
- May contain letters and 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
- Review before Quiz - NOW is the time to ask
your questions
- Lab Assignment -
- Take the School Rules Quiz. Click the
link and follow the instructions. You MUST score 100% on this quiz
- Take the Visual Basic Quiz 1. Click the
link and 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
- Create a VB program to perform common
temperature conversions:
- Fahrenheight to Centigrade
- Centigrade to Fahrenheight
For your
conversion numbers:
- Fahrenheight temperature is 9/5ths of the
Centigrade temperature plus 32 (do the plus 32 last)
- Centigrade temperature is 5/9ths of the
Fahrenheight temperature minus 32 (do the minus 32 first)
- (If you can't figure out the conversion,
watch the board, I'll do some examples)
Some ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmTemperatureConverter.frm" and
"vbTemperatureConverter"
- Add a textbox for input
- Add a label for output
- Add instructions to the user
- Add variables at the top of the program
- Add and name a command button for each
conversion
- Here's the general steps for each button:
- Assign the input text into a properly
named variable of the proper data type
- Calculate the answer and assign the answer
to the output label caption
- Add a command button and code and "cancel"
for exit
- Save frequently
- Test and debug your program (call me for
assistance). Use numbers that are easy to confirm. For example:
68o F = 20o C and 20o
C = 68o F 77o F = 25o C and 25o
C = 77o F 86o F = 30o C and 30o
C = 86o F
- Add some other useful
temperature conversions, like Kelvin
- Complete any unfinished labs
|
|
| 9 |
09/19/05 |
|
Monday - English, Pledge &
Announcements, VB Input/Output, "vbTemperatureConverter2" |
|
- Classroom Discussion -
- One AM student needed as volunteer to assist
Mr. Coleman with the morning pledge and announcements
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- VB Code Comments or Remarks - Remarks help
both you and other programmers who might modify and 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 ' And 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 and 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 and 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
- VB Output - MsgBox() - Instructions or output
to the user, returns a number that tells which button the user has
clicked:
- Do lab 1
- 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
- Do lab 2
- Lab Assignment -
- Modify your "vbTemperatureConverter.vbp"
program to use a MsgBox:
- Use a MsgBox to tell the user goodbye on
exit
Some ideas:
- Use windows explorer and navigate to where
your program "vbTemperatureConverter.vbp" is saved and open it
- Add a new global variable at the top:
Dim intMsgRes As Integer
- View the form and double click command
button exit
- Add VB code for a MsgBox before the "End"
command:
intMsgRes = MsgBox("Goodbye") ' This line added 09/19/05
- Test it to see how it works
- Modify the VB msgbox code to see how some of
the icons and buttons and title work:
intMsgRes = MsgBox("Goodbye", vbInformation, "Exit Message") ' Modified 09/19/05
or
intMsgRes = MsgBox("Goodbye", vbOKOnly, "Son of a Gun") ' Modified 09/19/05
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")
- Modify your "vbTemperatureConverter.vbp"
program to use an InputBox:
- Use an InputBox to allow the user to confirm
the temperature
- Echo the user input from the textbox as the
default in an InputBox and ask the user it this is accurate
Some ideas:
- View the form and double click command
button FahrToCent
- Add 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) ' Added 09/19/05
sngCent = (sngFahr - 32) * 5 / 9
lblOutput.Caption = sngCent
- Test it to see how it works
- Modify the VB msgbox code to see how the
title works:
sngFahr = InputBox("Convert this temperature?", "Temperature Confirmation, sngFahr)
- Save frequently
- Add a confirm exit
MsgBox to all of your VB programs
- English - Ms. Gerick will be in today to help
us create an instruction manual for software release
|
| 10 |
09/20/05 |
|
Tuesday - Vocabulary, Pledge &
Announcements, VB IF THEN Statement, "vbPayroll", "vbGrades" |
|
- Classroom Discussion -
- One AM student needed as volunteer to assist
Mr. Coleman with the morning pledge and announcements
- Vocabulary:
- Three types of statements in every
programming language:
- Sequential - Following of one after
another
- Decision - The act of reaching a
conclusion or making up one's mind
- 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 and are used to represent quantities and
to express general relationships that hold for all members of the
set
- George Boole (1815-1864) - British
mathematician and logician who developed a calculus of symbolic
logic
- Boolean - Of or relating to a logical
combinatorial system treating variables, such as propositions and
computer logic elements, through the operators AND, OR, NOT, and XOR
- Boolean Algebra - An algebra in which
elements have one of two values and the algebraic operations defined
on the set are logical OR, a type of addition, and logical AND, a
type of multiplication
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- Review Arithmetic Operators and Order of
Operations (PEMDAS):
- ( ) Parenthesis
- ^ Exponentiation
- * Multiply
- / Divide
- + Add
- - Subtract
- Review String Arithmetic Operator:
- Comparison Operators:
- > Greater Than
- < Less Than
- = Equal To
- >= Greater Than or Equal To
- <= Less Than or Equal To
- <> Not Equal To
- 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 and Boolean Algebra
- Comparison Examples:
- lblSales.Caption > Goal
- Pay < 2000.00
- Age = Limit
- FirstName >= "Mike"
- Num <= lblAmt.Caption
- txtAns.Text <> "Yes"
- The VB IF THEN Statement:
- Lab Assignment -
- Create a new VB program to process payroll:
- Receive hours worked from the user
- Receive pay rate from the user
- Calculate and display gross pay
- Calculate and display taxes
- Calculate and display net pay
Program Logic:
- User will enter hours worked and pay rate,
so you need to save this data to variables
- Gross pay is calculated as hours worked
times pay rate
- Taxes is calculated as 20% of gross pay
- Net pay is the result of subtracting taxes
from gross pay
Some ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmPayroll.frm" and "vbPayroll.vbp"
- Create variables at the top:
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
- Add a command button to exit, set the cancel
property to true so the escape key works, add the code to end
- 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
- Add a command button to go, set the default
property to true so the enter key works, add the code:
- Receive sngHoursWorked and sngPayRate from
the user using InputBoxes:
sngHoursWorked = InputBox("Enter Hours Worked", "Hours Worked", 30)
sngPayRate = InputBox("Enter Pay Rate", "Pay Rate", 10)
- Calculate gross pay, taxes, and net pay:
sngGrossPay = sngHoursWorked * sngPayRate
sngTaxes = sngGrossPay * .2
sngNetPay = sngGrossPay - sngTaxes
- 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
sngmsgres = MsgBox(strResults, vbOKOnly, "Payroll")
- Test with these numbers. If you enter hours
and rate, your resulting gross, taxes, and 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 |
- Save frequently
- What can you think of
to do to make this program better?
- Create a new VB program to determine a letter
grade given a numberical grade. Consider:
- Read a number grade and 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:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmGrades.frm" and "vbGrades.vbp"
- What variables do you need?
- Is the number grade variable integer or
single?
- What data type is the letter grade variable?
- How will you receive your input (number
grade)?
- How will you code the decision the computer
needs to make?
- Is the order in which you test number grade
important?
- How will you display the result to the user?
- Test all possibilities: 100, 95, 85, 75, 65,
55, 0
- Save frequently
- What can you think of
to do to make this program better?
|
| 11 |
09/21/05 |
|
Wednesday - Career, "vbTicTacToe" |
|
- Classroom Discussion -
- One AM student needed as volunteer to assist
Mr. Coleman with the morning pledge and announcements
- Career - News:
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- 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
- Lab Assignment -
- Take the Job Seeking Skills Pre-Test.
Click the link and 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
- Create a Visual Basic game of Tic Tac Toe:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmTicTacToe.frm" and "vbTicTacToe.vbp"
- Design the form:
- Exit button, write and 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
- Variables:
- strNextPlay to hold either "X" or "O" to
indicate which player plays next
- Code for cmdTopLeft:
- Only allow clicks if the button has not
already been clicked
- Determine which player plays next and
change the button caption to that letter
- Change the variable that indicates which
player plays next
- Test it
- Comment-out the "only allow clicks"
decision statement and test it again
- Code for cmdTopCenter:
- Copy the code for cmdTopLeft to
cmdTopCenter
- Change all references to topleft to
topcenter
- Test it
- Repeat copy for each of the other seven
buttons, testing each time
- Remove the comment-out of the "only allow
clicks" decision statement in every button
- Add a command button for "Reset" and code it
to change all button captions to "" and reset and display the which
player plays next variable to "X"
- Consider how to check for a winner -- how
many ways can you score three in a row?
- Top row horizontal
- Middle row horizontal
- Bottom row horizontal
- Left column vertical
- Center column vertical
- Right column vertical
- Top left to bottom right diagonal
- Top right to bottom left diagonal
- Code a single check for winner and announce
a winner and test it
- After finding a winner, prevent clicks on
any play buttons
- Code the rest and test them
- Copy all the tests to all the command
buttons
- What can you think of
to do to make this program better?
|
| 12 |
09/22/05 |
|
Thursday - Science, Pledge &
Announcements, VB IF THEN ELSE Statement, "vbPayroll2" |
|
- Classroom Discussion -
- One AM student needed as volunteer to assist
Mr. Coleman with the morning pledge and announcements
- Science:
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- Review yesterday: Arithmetic Operators, String
Aritmetic Operator, Comparison Operators, Comparison Rules
- The VB IF THEN ELSE Statement:
- Lab Assignment -
- Modify your vbPayroll program to work with
overtime. Program Logic:
- Hours worked up to and including 40 is
normal time and receives normal pay
- Any hours worked over 40 is considered
overtime and receives 1.5 times pay rate
- Only hours worked over 40 gets time and a
half and this is added to normal 40 hour pay
- The computer must make a decision - use an
IF THEN ELSE statement
Some ideas:
- 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
- Test all possibilities: 100, 95, 85, 75, 65,
55, 0
- Save frequently
- What can you think of
to do to make this program better?
|
| 13 |
09/23/05 |
|
Friday - Grade Print Sheet, Skills USA,
Pledge & Announcements, VB Nested IF THEN ELSE Statement,
"vbGrades2" |
|
- Classroom Discussion -
- One AM student needed as volunteer to assist Mr.
Coleman with the morning pledge and announcements
- Grades in "H:\Grades\" folder. To print:
- Double-Click to open in Microsoft Excel
- "Edit" "Select All" or just "Ctrl-A"
- "Format" "Columns" "Auto Fit"
- Just print the first page, we may never have
enough assignments to fill up more than one page.
Save the Trees
- Skills USA
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- Nested VB IF THEN ELSE Statements:
- Lab Assignment -
-
- Modify your vbGrades program to use nested IF
THEN ELSE statements. Program Logic:
- Perform nested testing to determine where
the number grade is
Some ideas:
- 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
- What can you think of
to do to make this program better?
|
|
| 14 |
09/26/05 |
|
Monday - Math (postponed), Cittone
Guest Speaker |
|
- Classroom Discussion -
- Guest speaker from Cittone at 9:00 and 11:00
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- Lab Assignment - Complete any incomplete work
|
| 15 |
09/27/05 |
|
Tuesday - Computer Vocabulary, Boolean
Logic, VB SELECT CASE Statement, "vbGrades3" |
|
- Classroom Discussion -
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- 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 and are used to represent quantities and
to express general relationships that hold for all members of the
set
- The first origin of the word Algebra from faqts.com
- Another origin of the word Algebra from algebra.com
- A third origin of the word Algebra from wikipedia.org
- George Boole (1815-1864) - British
mathematician and logician who developed a calculus of symbolic
logic
- Boolean - Of or relating to a logical
combinatorial system treating variables, such as propositions and
computer logic elements, through the operators AND, OR, NOT, and XOR
- Boolean Algebra - An algebra in which
elements have one of two values and the algebraic operations defined
on the set are logical OR, a type of addition, and 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 and overlap of the circles
indicating the relationships between the sets
- Links:
- Review Chapter 7 from Free-Ed.Net on Visual Basic,
"Making Decisions"
- 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 < and >
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 and
end value2 THEN statements A are performed
- IF expression3 is between start value3 and
end value4 THEN statements B are performed
- IF expression3 is between start value5 and
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 and easy-to-use programming technique
- SELECT CASE can be much easier to write and
understand than complex nested IF THEN ELSE statements
- Lab Assignment -
- Modify your existing Grades program using
SELECT CASE to eliminate the nested IF THEN ELSE statements
- Open recent project name "vbGrades2.vbp"
- Remove the existing IF THEN logic
- Replace with SELECT CASE logic
- Test using the same numbers: 100, 95, 85,
75, 65, 55, 0
- Save frequently
|
| 16 |
09/28/05 |
|
Wednesday - Career, Time-Value of
Money, "vbMoney" |
|
- Classroom Discussion -
- Career - Job Hunting
- Time-Value of Money, the rule of 72
- Lab Assignment -
- Create a VB program to view time-value of
money Future-Value calculations:
- Future Value of a One-Time Deposit
- You need to know three things:
- Starting Value - How much you're starting
with
- 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:
- Use the VB IDE to help you place the
variables in the function
Some ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmMoney.frm" and "vbMoney.vbp"
- Add textboxes for input:
- Deposit
- Rate
- Term
- Value
- Add labels to identify all textboxes
- Add instructions to the user
- Add variables at the top of the program:
- dblDeposit
- dblRate
- dblTerm
- dblValue
- intMesRet
- Add command buttons:
- Calculate Future Value
- Exit
- Steps for the Calculate Future Value button:
- Test each input textbox for a positive
value and then assign the value (use "Val(txtInput.text)") of the
textbox to the variable
- Assign the result of the predefined Visual
Basic function "FV" to the output variable
- Display the variable, formatted as
currency, on the output label
- Add a command button and code and "cancel"
for exit
- Save frequently
- Test and debug your program (call me for
assistance). Use numbers that are easy to confirm. For example:
| Deposit |
Rate |
Term |
Value |
| 100 |
5 |
1 |
$105.12 |
| 100 |
10 |
1 |
$110.47 |
| 100 |
10 |
10 |
$270.70 |
| 1000 |
10 |
40 |
$53,700.66 |
- Does savings pay off?
|
| 17 |
09/29/05 |
|
Thursday - Science, DeVry, Save for a
Goal, "vbMoney2" |
|
- Classroom Discussion -
- Guest speaker from DeVry at 9:00 and 11:00
- Science:
- Visual Basic Pre-Defined Built-In Functions:
- Lab Assignment -
- Modify the time-value of money VB program to
view Payment calculations:
- How much will you need to save each month to
reach a certain value
- You need to know three things:
- Future Value - How much you want to end up
with
- 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:
- Use the VB IDE to help you place the
variables in the function
Some ideas:
- Open VB & create a new, standard.exe
- Save the form and project to your "My
Documents/vb" folder as "frmMoney.frm" and "vbMoney.vbp"
- Add a new textbox for input:
- Final
- Add labels to identify the new textbox
- Add a new variables at the top of the
program:
- dblFinal
- Add a new command button:
- Calculate Payment
- Steps for the Calculate Future Value button:
- Test the new input textbox for a positive
value and then assign the value (use "Val(txtInput.text)") of the
textbox to the variable
- Assign the result of the predefined Visual
Basic function "PMT" to the output variable
- Display the variable, formatted as
currency, on the output label
- Add a command button and code and "cancel"
for exit
- Save frequently
- Test and 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 |
- When is it better to
pay cash?
|
| 18 |
09/30/05 |
|
Friday - Skills USA |
|
- Classroom Discussion -
-
- Lab Assignment -
-
|
|
| 19 |
10/03/05 |
|
Monday - English, VB Loops,
"vbNumberLoops" |
|
- Classroom Discussion -
- English - Ms. Gerrick will visit and discuss
how to review and edit an instruction manual for software release
- 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
- Usage:
- Works with comparison tests, just like
decisions
- The six comparision operators
( < > = <= >= <> )
work just the same
- The block of code continues being
interpreted and executed as long as the comparison returns a TRUE
result
- When the comparison returns a FALSE result,
the loop ends and 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
- Rules:
- 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
- Warnings:
- YOU MUST SAVE YOUR PROGRAM BEFORE TESTING A
LOOP - if an infinite loop condition occurs, you may have to reset
your computer and will lose any changes that have not been saved -
REMEMBER
- You'll get an infinite loop if the sentinel
variable does not change to make the comparison FALSE
- If you get an infinite loop, wait, Windows
may detect it and display a message box saying you have a slow
running program and asking if you want to abort it - answer yes
- Loop Safety:
- You set it up during testing
- Create a variable Dim intSafety As Integer
- Before you start the loop, initialize
intSafety = 50
- Inside the loop, decrement intSafety =
intSafety - 1
- Inside the loop, test If intSafety < 0
Then display an exit message and End Sub
- 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
- Chapter 8 from samsPublishing.com:
- 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
- Lab on DO WHILE
- 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
- Lab on DO UNTIL
- Syntax of the DO LOOP UNTIL:
Do
Block of one or more Visual Basic statements C
Change the sentinel variable
Loop Until comparisontest3
Similar to the DO UNTIL execute statements C until comparison
test 3 becomes TRUE - will always execute statements C at least once
- Lab on DO LOOP UNTIL
- Syntax of the FOR NEXT:
For counterVar = startVal To endVal [Step incrementVal]
Block of one or more Visual Basic statements D
The sentinel variable (counterVar) changes automatically
Next CounterVar
Will execute statements D (endVal - startVal) times - if
startVal is greater than endVal, will not execute statements D at
all
- Lab on FOR NEXT
- Lab Assignment -
- Edit the user manual you created for your Tic
Tac Toe game
- On-screen practice with Picture Box object and
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 and display the
contents
- Use "picOutput.Cls" inside another command
button event to clear screen the picture box
- On-screen practice with VB loops:
- Display a series of numbers from 1 to 10
- Display odd numbers from 1 to 10
- Display multiples of three (3,6,9,etc.)
- Start number to represent where the user
wants the loop to begin
- Stop number to represent where the user
wants the loop to end
- Step number to represent how the user wants
to skip (ie: 2 4 6 or 3 6 9 etc.)
|
| 20 |
10/04/05 |
|
Tuesday - Computer Vocabulary, VB Loop
Practice, "vbPrime", "vbFactorial" - Brick, Jackson, Lakewood - No School |
|
- Classroom Discussion -
- Computer Vocabulary - Bellingham Public Schools
- Chapter 8 from samsPublishing.com:
- Review VB Loops
- Definitions:
- Sum - an amount obtained as a result of
adding numbers
- Factorial - the product of all the positive
integers from 1 to a given number
- Prime - 1 positive integer not divisible
without a remainder by any positive integer other than itself and
one
- Visual Basic MOD - divide two numbers and
return only the remainder as an integer
5 mod 3 returns 2
Useful to see if a number can be divided evenly by another
number 5 mod 2 returns 1 - odd
6 mod 2 returns 0 - even
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
- Lab Assignment -
- Practice with loops - Modify your loop program
for:
- Display the sum of all numbers between user
choice of start and stop
- Display Factorial for the user choice
- Display the prime numbers between user
choice of start and stop
|
| 21 |
10/05/05 |
|
Wednesday - Career, VB Loop Practice,
"vbStars" - Jackson, Lakewood - No
School |
|
- Classroom Discussion -
- Career - 7 Steps to Get a Job:
- Chapter 8 from samsPublishing.com:
- Review VB Loops
- Lab Assignment -
- Create a new Visual Basic program to use loops
to draw shapes with one character:
- Open Visual Basic and create a new standard
executable
- Name the form "frmStars.frm" and the project
"vbStars.vbp"
- Add a large picture box object for output
- Add a textbox object and label for to let
the user specify how many
- Add a textbox object and label for to let
the user specify the symbol
- Add a command button object to draw one
symbol
- Add a command button object to draw a row of
how many symbols
- Add a command button object to draw a box of
how many symbols
- Add a command button object to draw a right
triangle of how many symbols
- Add a command button object to draw a
left-sided right triangle of how many symbols
- Add a command button object to draw an
isosceles triangle of how many symbols
|
| 22 |
10/06/05 |
|
Thursday - Science, VB Loop Review,
Quiz VB Decisions and Loops, "vbGCD" |
|
- Classroom Discussion -
- Reminder - No School on:
- Friday - October 7th - Teacher In-Service
- Monday - October 10th - Columbus Day
- Thursday - October 13th - Yom Kippur
- Chapter 8 from samsPublishing.com
- Review VB Loops
- Lab Assignment -
- Take the Visual Basic Quiz 2. Click the
link and follow the instructions. You only get one chance - this is
not "try until you score 100". Open notes, open internet, open VB IDE
(you may try out your answer in a program before you submit it), you
may ask me for clarification, you may NOT ask me for the answers, likewise you
may NOT ask another student
- Quiz Part
II - Design, write, create, test, run, and 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 and num2 = 18 then gcd = 6
given num1 = 12 and num2 = 21 then gcd = 3
given num1 = 12 and num2 = 24 then gcd = 12
given num1 = 12 and num2 = 28 then gcd = 4
given num1 = 28 and 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" and 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
- Save frequently
- When complete, copy to your "H:/VB" folder
so I can grade it
- Grading Criteria:
- Form must be named
- Form objects (except labels) must be named
- You must have your name, date, and program
name as comments at the top of the code
- You must use "Option Explicit"
- Variables must be named and declared
- Exit button must ask if I really want to
exit
- Determine button must provide the correct
answer to all test input. I will test with the numbers given above
- Output must echo user input so that the user
can see and fix his own misteaks
- Output must show the correct answer
- Use enough text in the output to describe
what the numbers mean
- Open online book, open notes, you may ask
clarification questions but I will not code this for you, you may
NOT ask your fellow
students for help
- Take as much time as you need to get it
right
- If we have time, we'll complete the vbStars
loop practice program from yesterday on the board together
- HAVE A
GRAND WEEKEND!!!
|
|
10/07/05 |
|
Friday -
OCVTS School Closed - Teacher In-Service |
|
|
10/10/05 |
|
Monday -
OCVTS School Closed - Columbus Day |
| 23 |
10/11/05 |
|
Tuesday - Computer Vocabulary, Boolean
Logic in Programming, VB Loop Practice, "vbTimesTable" |
|
- Classroom Discussion -
- Spanish Computer Terms -
Recognize any?
- Review of quiz from last week
- Chapter 8 from samsPublishing.com:
- Review of VB Loops
- 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) | |
- Boolean Logic in Programming and PEMDAS
- Parenthesis
- AND is like Multiply
- OR is like Add
- The AND pair will compare before the OR pair
- To make the OR pair compare before the AND
pair, you MUST USE PARENTHESIS!!!
- 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 AND to compare two possible
answers to different variables:
- strDirection = "up" AND strAnswer = "yes"
- strAnswer = "YES" OR 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 and 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")
- Lab Assignment -
- Finish "vbStars.vbp" from Wednesday
- Create a Visual Basic program to display a
times table chart. Give the user the option of starting and stopping
at different numbers. Give the user the choice of a multiplier. Sample
output for start number 5, stop number 9, and multiplier 2:
| 5 times 2 is 10 |
| 6 times 2 is 12 |
| 7 times 2 is 14 |
| 8 times 2 is 16 |
| 9 times 2 is 18 |
- Modify the "vbTimesTable.vbp" Visual Basic
program to draw a table in addition to a list. Use numbers across the
top and down the side. Display the product of the two numbers in a
table in between. For example:
|
1 |
2 |
3 |
| 1 |
1 |
2 |
3 |
| 2 |
2 |
4 |
6 |
| 3 |
2 |
6 |
9 |
|
| 24 |
10/12/05 |
|
Wednesday - Career, VB Loop
Practice |
|
|
|
10/13/05 |
|
Thursday -
OCVTS School Closed - Yom Kippur |
| 25 |
10/14/05 |
|
Friday - Skills USA, PDP, Review,
Quiz |
|
- Classroom Discussion -
- Chapter 8 from samsPublishing.com:
- Review of Boolean Logic in Programming
- Lab Assignment -
- Take the Boolean Logic Quiz. Click the
link and 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
- Complete vbStars and vbTimesTable
|
|
| 26 |
10/17/05 |
|
Monday - English, Sub-Routines, VB
Sub-Routine Practice, "vbSubDemo" |
|
- Classroom Discussion -
- 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
- Pseudocode - A notation resembling a
programming language but not intended for actual compilation
- Sites:
- Chapter 13 from samsPublishing.com
- What benefits structured programming offers
- Why short, numerous procedures beat long
procedures
- How to write your own functions and
subroutines
- When to use functions
- How to code argument lists
- Why VB uses two argument-passing methods
- How to protect passed arguments
- Lab Assignment -
- Onboard demo and practice with
sub-routines
|
| 27 |
10/18/05 |
|
Tuesday - Computer Vocabulary,
Sub-Routines Cont'd, VB Sub-Routine Practice, "vbPayroll", "vbGrades",
"vbTicTacToe" |
|
- Classroom Discussion -
- French Computer Terms - Recognize any?
- Chapter 13 from samsPublishing.com,
cont'd
- Lab Assignment -
- Onboard practice, re-write the vbPayroll,
vbGrades, and vbTicTacToe programs to use sub-routines
|
| 28 |
10/19/05 |
|
Wednesday - Career, Sub-Routines
Cont'd, VB Sub-Routine Practice, "vbDistanceConvertor" |
|
- Classroom Discussion -
- Career assessment from LiveCareer.com - signup, take the
assessment, print out, put you name on, and hand in the chart.
Remember - don't pay for stuff on the internet and don't sign up for
any advertizements
- 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, and
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, and a
procedure, which performs some operation but does not return a value
- Chapter 13 from samsPublishing.com, cont'd
- 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
- Lab Assignment -
- Onboard practice, modify vbDistanceConvertor
to:
- Change label captions
- Use functions
- Pass arguments to one function
|
| 29 |
10/20/05 |
|
Thursday - Technical Movie - Mr. Clarke
at Conference |
|
- Classroom Discussion -
- Watch movie
- Lab Assignment -
- Complete movie review form
|
| 30 |
10/21/05 |
|
Friday - Technical Movie - Mr. Clarke
at Conference |
|
- Classroom Discussion -
- Watch movie
- Lab Assignment -
- Complete movie review
form
|
|
| 31 |
10/24/05 |
|
Monday - Math, Movie Review, VB
Functions, "vbPower" - Spirit Week -
Neck-up Dress-up Day |
|
- Classroom Discussion -
- Did you enjoy the moview? What technology was
involved in the movie plot? How has the technology changed since the
movie was filmed?
- Ms. Verde will discuss exponentiation, raising
a number to a power
- Chapter 13 from samsPublishing.com, cont'd
- Lab Assignment -
- Create a Visual Basic program "vbPower.vbp" to
raise a number to a power:
- Write the pseudocode or flowchart
- Create the form
- Write the code for exit
- Test:
| number |
power |
answer |
| 3 |
3 |
27 |
| 8 |
2 |
64 |
| 2 |
8 |
256 |
| 5 |
4 |
625 |
| 4 |
5 |
1024 |
- Save frequently
|
| 32 |
10/25/05 |
|
Tuesday - Vocabulary, VB Functions,
"vbNames" - Spirit Week - Sports
Day |
|
- Classroom Discussion -
- Why are you here? Why am I here?
- Visual Basic Listbox Object
- Chapter 10 from samsPublishing.com,
cont'd
- Lab Assignment -
- Create a Visual Basic program "vbNames.vbp" to
work with the Listbox object
- Add a command button and code to exit
- Add a listbox object "lstNames"
- Add a command button to accept a name as
input from the user and add it to the listbox "lstNames.AddItem
strItemName"
- The input may not be blank
- The input may not contain spaces
- After adding the item to the listbox, clear
the input and set the focus "lstNames.Clear"
- Add a command button to clear all names from
the listbox "lstNames.Clear". Include a message box to confirm
- For testing, add a command button to add a
series of 10 predeterimined-names
- Add a command button to accept a number from
the user and display only that item from the listbox in a message
box "lstNames.List(intIndex)"
- The input may not be blank, must be a
number, and must be the correct size, don't accept a number greater
than the number of items in the list "lstNames.ListCount", give an
error message instead
- After displaying the item from the listbox,
clear the input and set the focus
- Test and save frequently
- Modify the Listbox program to include a list
of passwords
- Add a password input textbox
- Both name and password may not be empty when
adding
- Display command button must display both
name and password
- Clear command button must clear both name
and password listboxes
|
| 33 |
10/26/05 |
|
Wednesday - Career, VB Functions,
"vbStates" - Spirit Week - Backwards
Day |
|
- Classroom Discussion -
- 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 and statistics
- Visual Basic Combobox Object
- Chapter 10 from samsPublishing.com, cont'd
- Reading from a text file:
- Lab Assignment -
- Create a Visual Basic program "vbStates.vbp"
to list all 50 U.S. states in a Combobox:
- Modify the states program to include state
capitals:
- Create a text file with the names of all 50
U.S. state capitals (Google search and copy)
- Add a combox "cboCapitals"
- Load the state capitals on Form_Load()
- Add a command button "cmdCapital" to display
the state capital for the selected state
- If the user has selected a state, locate the
appropriate capital and display both
- Test and save frequently
|
| 34 |
10/27/05 |
|
Thursday - Science, VB Functions,
"vbStates" - Spirit Week - Twin
Day |
|
- Classroom Discussion -
- How Stuff Works Electronic Payment
- Visual Basic option buttons, also called radio
buttons, in chapter 10 from samsPublishing.com
- Lab Assignment -
- Finish our Visual Basic States Capitals game
from yesterday to make it more game-like. Pseudocode:
- Start the game with both combo box objects
invisible
- Use option buttons to let the user control
which game to play: guess capitals or guess states
- Add a frame object with the caption "Choose
Game"
- Draw an option
button named "optGuess" inside the frame
- Copy the option
button, Click on the frame, Paste another option button, CREATE A CONTROL OBJECT
- The first option button is now named
"optGuess(0)" and the second is named "optGuess(1)" - this is how
you tell them apart
- Set the caption for the first option button
to "Guess Capital" and the second caption to "Guess State"
- Create a new global variable "strGame" as
String
- Double-Click one of the option buttons
- To the new sub-routine "Private Sub
optGuess_Click(Index As Integer)" add these lines:
If Index = 0 Then ' user wants to guess capital
cboStates.Visible = True ' show the states combo box
cboCapitals.Visible = False ' hide the capital combo box
strGame = "States" ' user wants to guess capital
Else ' user wants to guess state
cboStates.Visible = False ' hide the states combo box
cboCapitals.Visible = True ' show the capital combo box
strGame = "Capitals" ' user wants to guess state
End If
- Modify the "cmdGuess" command button code:
lblAnswer.Caption = "" ' clear the contents of the output label
If strGame = "States" Then ' if user wants to guess capital
If cboStates.ListIndex >= 0 Then ' if user has clicked on a state
lblAnswer.Caption = "The capital of " & cboStates.List(cboStates.ListIndex) _
& " is " & cboCapitals.List(cboStates.ListIndex)
End If
Else
If cboCapitals.ListIndex >= 0 Then ' if user has clicked on a capital
lblAnswer.Caption = cboCapitals.List(cboCapitals.ListIndex) _
& " is the capital of " & cboStates.List(cboCapitals.ListIndex)
End If
End If
- Modify the State Capitals game to make it more
game-like. Add a guessing segment by displaying both combo boxes and
letting the user click both to see if they match. Pseudocode:
- New variables: "strCapitalPick" and
"strCapitalReal"
- Copy and paste into the frame one of the two
existing option buttons. You already have a control array, so VB
won't ask if you want to create one
- Change the caption of the new button to
"Play Game"
- Copy and paste the "cboCapitals" combo box
but do not create a control array, new name "cboCapitalsSorted", and
set the sorted property to "True"
- In the "Form_Load()" sub-routine, set the
new combo box to invisible
- Modify the "optGuess_Click()" sub-routine
code to include the new button:
- Show the states combo box
- Hide the original capitals combo box
- Show the new capitals sorted combo box
- Set strGame = "Both"
Now, two combo
boxes show, "cboStates" and "cboCapitalSorted"
- Modify the "cmdGuess_Click()" sub-routine
code to include the new option:
- If both "cboStates.ListIndex" and
"cboCapitalsSorted.ListIndex" have been clicked (greater than
zero) then continue
- Save
"cboCapitalsSorted.List(cboCapitalsSorted.ListIndex)" into
"strCapitalPick"
- Save
"cboCapitals.List(cboStates.ListIndex)" into "strCapitalReal"
- If "strCapitalPick" is the same as
"strCapitalReal" display a winning message
- Otherwise display a losing message with
the correct answer
- Experiment with changing background and
foreground colors for correct or incorrect answers - Google search
if you need to
- If you change colors to vbRed and vbYellow,
how would you change back to vbBlack and gray? (there is no vbGray)
|
| 35 |
10/28/05 |
|
Friday - Skills USA, VB Quiz,
"vbAreaPerimeter" - Spirit Week -
Flashback Day |
|
- Classroom Discussion -
- Daylight Saving Time
- PDP Intro
- VB Quiz in lab
- Lab Assignment -
- Take the Visual Basic Quiz 3. Click the
link and follow the instructions. You only get one chance - this is
not "try until you score 100". Open notes, open internet, open VB IDE
(you may try out your answer in a program before you submit it), you
may ask me for clarification, you may NOT ask me for the answers, likewise you
may NOT ask another student
- Quiz Part
II - Design, write, create, test, run, and save a Visual Basic
program to display the area and perimeter of a rectangle. Area is
found by multiplying the height by the width. Perimeter is found by
the sum of twice the height plus twice the width. Form Design:
- 2 input text boxes: one for height, one for
width
- A label with instructions
- 1 or 2 labels for the answers
- Labels to identify all text boxes and any
output labels
- 2 command buttons: one for exit, one for
calculate
Pseudocode:
- Declare variables for height and width and
area and perimeter
- When the user clicks on exit, unload me
- When the user clicks on calculate, calculate
the area and perimeter and display the values
- If the two input text boxes are numeric,
convert the values and save into height and width variables
- Multiply height times width and put the
answer into area
- Add height plus height plus width plus width
and put the answer into perimeter
- Display both answers 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 |
- Save as "frmArea.frm" and "vbArea.vbp" to a
folder named "vbArea"
- If rectangle is a square, display some
message saying so
- If you have time remaining, make the form
look good - colors - font face and size - object placement -
organization
- When all complete, copy the folder to your
"H:/vb/" 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 and variable naming
conventions (txtSomething and intSomething) (5 pts)
- Must have at least one programmer-written
function or sub-routine (5 pts)
- Must have author name, program name, and
date written as comments (5 pts)
- Must look good (5 pts)
|
|
| 36 |
10/31/05 |
|
Monday - Happy Halloween - Vocabulary, VB Option
Buttons, "vbQuotes", mod "vbTicTacToe" - Spirit Week - Costume Day |
|
- Classroom Discussion -
- End of Marking Period 1 - 12 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Review of Friday's Programming Evaluation:
- Must be on "H:/VB/" folder in order for me
to grade
- Save as "frmArea.frm" and "vbArea.vbp" to a
folder named "vbArea"
- If rectangle is a square, display some
message saying so
- Must give correct answers (75 pts)
- Must use Option Explicit (5 pts)
- Must use correct object and variable naming
conventions (txtSomething and intSomething) (5 pts)
- Must have at least one programmer-written
function or sub-routine (5 pts)
- Must have author name, program name, and
date written as comments (5 pts)
- Must look good (5 pts)
- Computer and Technology Vocabulary
- Visual Basic option buttons, also called radio
buttons, in chapter 11 from samsPublishing.com
- Lab Assignment -
- Create a Visual Basic program giving control
to the user. Today we'll be using loads of option buttons:
Pseudocode:
- Name: "vbQuotes"
- Add an "Exit" command button object to allow
the user to exit
- Add a label object "lblQuote" to display a
quote from music, movie, or television
- Add a "Change" command button object to
allow the user to change the quote
- Find 5 quotes online
- Use a variable to display 1 of the 5
quotes
- Add 1 to the quote variable
- If quote variable is greater than 5, make
it 1
- Use the quote variable to determine which
quote to display
- Display the quote on the label
- Save & Test
- Add 6 option (radio) button objects to allow
the user to change the label background color
- Add a frame object named "frmBackColor"
with the caption "Back Color"
- Draw an option button object named
"optBackColor" onto the frame do not double
click
- Copy the option button, click on the
frame, paste and create a control array
- Repeat until you have 6 option buttons on
the frame
- Change the captions to "Red", "Green",
"Blue", "Yellow", "Magenta", and "Cyan"
- Double-Click on one of the option buttons
- Add code so that when the user clicks on
one, change the label backColor property to the correct color
- Save & Test
- Add another frame "frmTextColor" and 6 more
option button objects to change the label foreColor property
- Save & Test
- Add another frame "frmFontName" and 12 ro so
option button objects to change the label fontName property
- Save & Test
- Modify your TicTacToe game to use option
button objects to allow the user to choose who plays first
- Complete any unfinished
assignments
|
| 37 |
11/01/05 |
|
Tuesday - English, VB Check Boxes,
"vbQuotes", mod "vbGrades" |
|
- Classroom Discussion -
- End of Marking Period 1 - 11 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Ms. Gerrick will visit and work with us on
reading and comprehension, very important to technology people because
our users speak a different language and don't always know how to ask
for what they want, we as computer technology people, have to be able
to understand and sometimes translate
- Visual Basic check boxes in chapter 11 from samsPublishing.com
- Lab Assignment -
- Modify your "vbQuotes" project to allow the
user more control by using loads of check boxes
- Hide the label object quote on startup
- Add a checkbox object "chkShowQuote"
- Add code to the checkbox if the box is
checked then show the quote, test the checkbox value property for
vbChecked, if true, change the "lblQuote.visible" property to True,
else, change the "lblQuote.visible" property to False
- Save & Test
- Add a checkbox and code for making the
"lblQuote.fontBold" property true or false
- Save & Test
- Add a checkbox and code for making the
"lblQuote.fontItalic" property true or false
- Save & Test
- Add a checkbox and code for making the
"lblQuote.fontUnderline" property true or false
- Save & Test
- Add a checkbox and code for making the
"frmBackColor.visible" property true or false
- Save & Test
- Add a checkbox and code for making the
"frmTextColor.visible" property true or false
- Save & Test
- Add a checkbox and code for making the
"frmFontName.visible" property true or false
- Save & Test
- Modify your grades program to add a checkbox
object to allow the user to choose whether to show lettergrade and gpa
or only lettergrade
- Complete any unfinished
assignments
|
| 38 |
11/02/05 |
|
Wednesday - Career, VB Scrollbars,
"vbQuotes", mod "vbTemperature" and/or "vbDistanceConverter" |
|
- Classroom Discussion -
- End of Marking Period 1 - 10 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Review learning styles from Chaminade College Preparatory School
- Visual Basic scrollbars in chapter 11 from samsPublishing.com
- Lab Assignment -
- Take both of the following online learning
styles assessments and write down your learning styles
- University of Arizona
- LDpride
- Record your answers in a table like this:
|
ArizonaU |
LDPride |
| Visual |
|
|
| Auditive |
|
|
| Kinestetic |
|
|
- Now that you know how you learn best, will
you change the way you study?
- Modify your "vbQuotes" project to allow the
user more control by using loads of scrollbars
- Add a horizontal scrollbar "hsbTextSize" (if
you add a vertical scrollbar "vsbTextSize")
- Set the scrollbar minimum property to 8 and
the maximum property to 32
- Set the scrollbar smallChange property to 2
and the largeChange property to 8 and the value property to 12
- Write the code on change to set the
"lblQuote.fontSize" equal to the "hsbTextSize.value"
- Save & Test
- Add a scrollbar "hsbJustify" min = 0, max =
2, smallChange = 1, largeChange = 1, value = 0, and code to change
"lblQuote.Alignment"
- Save & Test
- Add a scrollbar "hsbVisible" min = 0, max =
1, smallChange = 1, largeChange = 1, value = 0, and code to change
"lblQuote.visible" True or False and "chkShowQuote.value" to the
same as the scrollbar value
- Save & Test
- Add a scrollbar "hsbQuote" min = 0, max = 8,
smallChange = 1, largeChange = 1, value = 0, and code to change
"lblQuote.caption" to the correct quote and be sure to change the
quotenumber variable
- Save & Test
- Modify your distance and/or temperature
converter programs to use scrollbars to input the distance or
temperature
- Complete any unfinished
assignments
|
| 39 |
11/03/05 |
|
Thursday - Science, VB Timers,
"vbQuotes", mod "vbTrafficLight" |
|
- Classroom Discussion -
- End of Marking Period 1 - 9 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- How SMS Works
- Visual Basic timers in chapter 11 from samsPublishing.com
- Lab Assignment -
- 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" and 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 and set "intTimer" back to 5, else decrement
"intTimer"
- Save & Test
- Modify your "vbLight" traffic light program
to automatically change the lights, say 20 seconds red, 15 seconds
green, and 5 seconds yellow
- Complete any unfinished
assignments
|
| 40 |
11/04/05 |
|
Friday - PDP, SkillsUSA, VB Weekly
Review, "vbImageDisplayer2" |
|
- Classroom Discussion -
- End of Marking Period 1 - 8 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- PDP - Level 1.1 - Self Assessment
- Week Review VB option buttons, check boxes,
scrollbars, & timers
- Visual Basic additional controls in chapter
11 from samsPublishing.com
- Lab Assignment -
- Create a VB program "vbImageDisplayer2" to
display a series of images using an image, a timer, a scrollbar, and a
checkbox:
- Open VB, make a new executable, name the
form, save into a folder, and close VB
- Open Windows Explorer ("My Documents" or
"My Computer"), browse to the folder, and open the project by
double-clicking
- Add and code an Exit command button object
- Add an image or picture object to display
your images
- Search for and copy up to 10 images off the
internet and save them into the correct folder
- Add and code a timer object to control
switching the image automatically
- Add and code a scrollbar object to control
the timer interval, how long an image is displayed before it
switches
- Add and code a checkbox object to control
whether the timer is enabled True or False
- Add and code a label object to display the
name of the current displayed image
- Save and test
- Copy to your "H:/VB/" folder so I may look
at it
- Complete any unfinished
assignments
|
|
| 41 |
11/07/05 |
|
Monday - Math, "vbOhmsLaw",
"vbPong" |
|
- Classroom Discussion -
- End of Marking Period 1 - 7 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Math - with Ms. Verde - Ohm's Law pie chart and java applet lightbulb circuit
- Complete Lab 1, "vbOhmsLaw"
- Visual Basic moving an object on the screen
while the program is running
- Visual Basic animating pictures in chapter 18
from samsPublishing.com
- Work on Lab 2, "vbPong"
- Lab Assignment -
- Create a Visual Basic program "vbOhmsLaw":
- Open Visual Basic and create a new
executable
- Name the form "frmOhmsLaw" and name the
project "vbOhmsLaw"
- Design the form to let the user input 2
numbers
- Design the form to let the user choose
which calculation to use
- Process the correct calculation(s) and
display the answer(s)
- Save & Test
- Copy to your "H:/VB" folder so I may grade
it
- Create a Visual Basic program "vbPong".
Create a moving object by changing its top and/or left properties
inside a timer object. Our moving object is going to move within the
boundaries of the form, so we can use the form properties Top, Left,
Height, & Width:
- Open Visual Basic and create a new
executable
- Name the form "frmPong" and name the
project "vbPong"
- Make the form big - like Height=8000 &
Width=10000
- Find an image of a ball from the Internet,
copy & save to the folder as "ball.jpg" or "ball.gif"
- Add an Image object "imgBall" & set
properties: Height=1000 & Width=1000 & Picture="ball.jpg" or
"ball.gif"
- On form_load, set the position of the ball
at Top=1000 & Left=1000
- Add variables to control ball movement:
"blnBallMoveDown" & "blnBallMoveRight" & "intMoveSize"
- In the form_load, set variables to "True"
& "True" & 200
- Add variables to control ball bounce:
"intLeftEdge" & "intRightEdge" & "intTopEdge" &
"intBottomEdge"
- In the form_load, set variables to 1 &
"frmPong.Width - 1400" & 1 & "frmPongHeight - 1600"
- Add a Timer object "tmrBallMove" & set
properties: Interval=200
- Write code in the timer to change direction
of ball:
If imgBall.Left > intRightEdge Then blnBallMoveRight = False
If imgBall.Left < intLeftEdge Then blnBallMoveRight = True
If imgBall.Top > intBottomEdge Then blnBallMoveDown = False
If imgBall.Top < intTopEdge Then blnBallMoveDown = True
- Save & Test
- Write code in the timer to move the ball by
changing the top and left property:
Select Case blnBallMoveRight
Case 0: imgBall.Left = imgBall.Left - intMoveSize
Case 1: imgBall.Left = imgBall.Left + intMoveSize
End Select
Select Case blnBallMoveDown
Case 0: imgBall.Top = imgBall.Top - intMoveSize
Case 1: imgBall.Top = imgBall.Top + intMoveSize
End Select
- Save & Test
- Complete any unfinished
assignments
|
| 42 |
11/08/05 |
|
Tuesday - Computer Vocabulary,
"vbMadLibs", "vbPong" |
|
- Classroom Discussion -
- End of Marking Period 1 - 6 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Visual Basic string functions in chapter 14
from samsPublishing.com
- Work on Lab 1, "vbMadLibs"
- Work on Lab 2, "vbPong"
- Lab Assignment -
- Create a Visual Basic program "vbMadLibs:"
- Create a new Visual Basic executable
"frmMadLibs" & "vbMadLibs"
- Add a command button object and code for
exit
- Add 5 textboxes objects for user input of
words
- Add 6 string variables for your story
- In the form_load, create a story with holes
and initialize the 6 string variables
- Add a label object for output
- Add a command button object to write your
story
- Write the code to display your story with
the text from the 5 textboxes inserted into the holes in your story
- Display onto your output label caption
- Save & Test
- Modify the Visual Basic program "vbPong:"
- Open "vbPong"
- Draw a line object "linLeft" to be the left
paddle & set properties BorderWidth=10, X1=200, Y1=200, X2=1000,
Y2=2000
- Draw a line object "linRight" to be the
right paddle & set properties BorderWidth=10, X1=9600, Y1=9600
X2=1000, Y2=2000
- Double-click on the form and change the
procedure to "KeyPress"
- Code to check which key was pressed and
move the left or right line:
- w is 119, if KeyAscii = 119, move the
left paddle up, increment linLeft.Y1 & Y2 by 200
- s is 115, if KeyAscii = 119, move the
left paddle down, decrement linLeft.Y1 & Y2 by 200
- i is 105, if KeyAscii = 119, move the
right paddle up, increment linRight.Y1 & Y2 by 200
- k is 107, if KeyAscii = 119, move the
right paddle down, decrement linRight.Y1 & Y2 by 200
- escape is 27, if KeyAscii = 27, end the
program
- return is 13, if KeyAscii = 13, start the
ball
- Save & Test
- Code also to not let either paddle leave
the playing field:
- if linLeft.Y1 < intTopEdge put Y1 back
at intTopEdge and & Y2 1000 greater
- if linLeft.Y1 > intBottomEdge put Y2
back at intBottomEdge & put Y1 1000 less
- if linRight.Y1 < intTopEdge put Y1
back at intTopEdge & put Y2 1000 greater
- if linRight.Y1 > intBottomEdge put Y2
back at intBottomEdge & put Y1 1000 less
- Save & Test
- Complete any unfinished
assignments
|
| 43 |
11/09/05 |
|
Wednesday - Career, "vbMadLibs",
"vbPong" |
|
- Classroom Discussion -
- End of Marking Period 1 - 5 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- Career - Key steps to getting a job - view
the career page
- Visual Basic online text from samsPublishing.com
- Complete Lab 1, "vbMadLibs"
- Complete Lab 2, "vbPong"
- Lab Assignment -
- Modify the Visual Basic program "vbMadLibs:"
- Modify the Visual Basic program "vbPong:"
- Open "vbPong"
- Modify ball movement so that if it hits a
paddle it bounces
- Save & Test
- Add some variables and labels for keeping
and displaying score
- Initialize the variables to 0 in the
form_load
- Display the variables to the label captions
- If the ball hits the left wall, give the
right player 1 point
- If the ball hits the right wall, give the
left player 1 point
- Save & Test
- Determine and display a winner if one
player reaches 5 points
- Ask it replay and either exit or restart by
calling form_load
- Save & Test
- Complete any unfinished
assignments
|
|
11/10/05 |
|
Thursday -
OCVTS School Closed - NJEA Convention |
|
11/11/05 |
|
Friday -
OCVTS School Closed - NJEA Convention & Veterans' Day |
|
| 44 |
11/14/05 |
|
Monday - English, VB Practice:
"vbMadLibs", "vbVolumeConverter" |
|
- Classroom Discussion -
- End of Marking Period 1 - 4 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- MATES mid-term exams - please be
respectful and quiet
- English:
- Fractured English - mamarocks - Engrish in other countries
- Fractured English - egreely.com - Angleish in other countries
- Fractured English - msu.edu - Inglish in other countries
- Fractured English - ozjokes.com - Engleesh in
other countries
- Array Variables - 1 variable name with many
values - chapter 10.3 from samsPublishing.com - Sams calls
these "Data Arrays"
- Visual Basic online text from samsPublishing.com
- Lab Assignment -
- Create a Visual Basic Program "vbMadLibs":
- Create a new Visual Basic executable
- Add a command button object and
code to Exit
- Add a large picture box object "picOutput"
- Add a command button object and code to
clear the picture box
- Add a textbox object "txtHowMany" and label
it
- Add a command button object and code to
play:
- Create an array variable
"strWord(10)" as string
- Confirm that the textbox is numeric
- If not, display an error message
- If so, in a loop, load the array variable
with words from the user using an input box
- When all words have been added, display a
complete sentance to the picture box
- Save & Test
- Create a Visual Basic Program
"vbVolumeConverter":
- Create a new Visual Basic executable
- Design the form with sufficient controls
and objects
- Process some volume conversions:
- Gallons
- Quarts
- Pints
- Cups
- Ounces
- Liters
- Save & Test
|
| 45 |
11/15/05 |
|
Tuesday - Vocabulary, VB Practice:
"vbRandom", "vbNumberGuess" "vbWeightConverter" |
|
- Classroom Discussion -
- End of Marking Period 1 - 3 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- MATES mid-term exams - please be
respectful and quiet
- Visual Basic online text from samsPublishing.com
- Lab Assignment -
- Visual Basic program "vbRandom" to display
random numbers on a picture box:
- Create a new Visual Basic executable
- Add a command button object "cmdExit" to
exit
- Add a list box object "lstOutput"
- Add a command button object "cmdClear" to
clear the list box
- Add a command button object "cmdRandom"
to additem random numbers to the list box:
- Display random numbers:
"lstOutput.Additem rnd()"
- Save & Test - random numbers are
decimal numbers between 0.0 and 0.999
- Modify your code to display numbers between
1 and 6:
- Create variables "intHigh" and "intLow"
to hold the highest and lowest random numbers possible
- Initialize the variables in the
form_load() to 0 and 6
- Change the display line to read:
"lstOutput.Additem Int((intHigh - intLow + 1) * Rnd()) +
intLow"
- Save & Test
- Exit the program, run and test it again -
you should get the same numbers
- Modify your code to create more randomness:
- Add "Randomize" to the form_load()
- Save & Test - numbers should be much
more random
- Modify your form to allow the user to
choose highest and lowest:
- Add two textbox objects "txtHighest" and
"txtLowest"
- Modify the "cmdRandom" event subroutine
to confirm both textboxes are numerical
- If not, display an error message
- If so, convert to integer numbers and
assign to the correct variable
- Save & Test - random numbers should
be between the user chosen lowest and highest
numbers
- Visual Basic program "vbNumberGuess" to play
a game asking the user to guess a random number between 1 and 100:
- Create a new Visual Basic executable
- Add a label object with instructions to the
user
- Add a command button object and code to
exit
- Add a label object to provide feedback to
the user after the user guesses:
- User guess is too high (computer number
is lower)
- User guess is too low (computer number is
higher)
- User guessed the number correctly and is
a winner
- Add a textbox object to receive the user
guess
- Add two variables: intNumber to hold the
random number and intGuess to hold the user guess
- Add a command button StartGame:
- Generate a random number between 1 and
100
- Add a command button object to play the
game
- Confirm the user input is a number
- If not, display an error message
- If so, convert to an integer number and
assign the value to intGuess
- Compare intGuess to intNumber and provide
the user with the proper feedback
- Save & Test
- Modify to make more gamelike:
- Keep track of the number of incorrect
user guesses
- Limit number of user guesses to 7
- In StartGame, reset number of guesses to
0
- Save & Test
- Visual Basic program "vbWeightConverter":
- Create a new Visual Basic executable
- Design the form with sufficient controls
and objects
- Process some weight conversions:
- Ounces
- Pounds
- Tons
- British Tonnes
- British Stones
- Grams
- Save & Test
|
| 46 |
11/16/05 |
|
Wednesday - Career, VB Practice:
"vbSnake" |
|
- Classroom Discussion -
- End of Marking Period 1 - 2 days left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- MATES mid-term exams - please be
respectful and quiet
- Effective Job Search Methods - on my careers page
- Visual Basic online text from samsPublishing.com
- Lab Assignment -
- Visual Basic program "vbSnake":
- Rules:
- The "snake" will start with a length of 5
- The "snake" will start moving at 10
spaces each second (timer interval = 100)
- The "food" will appear randomly and last
for 5 seconds
- Each time the "snake" eats the "food"
("snake-head" top & left equal "food" top & left) the
"snake" grows and adds 5 additional segments
- The length of the "snake" will never
exceed 50 segments
- The speed will appear to increase when
the "snake" feeds (decrease timer interval)
- The speed will never exceed light-speed
- The game ends when the "snake" encounters
a wall ("snake-head" top & left pass outside the game field)
- The game ends when the "snake" encounters
part of its own body ("snake-head" top & left equal part of
the "snake" body)
- The number of "foods" the "snake" has
eaten will appear on a label on the form
- Create a new Visual Basic executable
- Design the form with sufficient controls
and objects
- Add a Shape object "shpBoard" for the game board
- Add a Shape object "shpHead" for the head of the snake
- Add a Shape object "shpFood" for the food
- Add a Timer object to control snake head movement
- Add a Label object "lblScore" to display the score
- Add a Label object "lblFoodTime" to display the food
time
- Write the code
- In the Form_Load(), set the board, snake head, and food
initial height/width sizes and top/left positions
- Keep track of direction with an integer number 1=up, 2=down,
3=left, 4=right
- On keyDown, use a Select Case to determine which key was
pressed and change direction variable
- In the timer:
- Use a Select Case to control direction
- Rest for snake head position on board or over board
- Randomly place food on board
- Test for snake head overlap food and increment score and
display score and move food
- Save & Test
|
| 47 |
11/17/05 |
|
Thursday - Science, VB Quiz:
"vbTipCalculator", "vbMagic8Ball" lab assignment |
|
- Classroom Discussion -
- Mr. Clarke out - Career Day at Central
Regional - be respectful of the substitute teacher
- End of Marking Period 1 - 1 day left
- Check your grades - if you haven't completed
an assignment, you may complete it this week
- MATES mid-term exams - please be
respectful and quiet
- Visual Basic online text from samsPublishing.com
- Lab Assignment -
- QUIZ - Take the Visual
Basic Quiz 4. Click the link and follow the instructions. PRINT AND HAND IN. You only get
one chance - this is not "try until you score 100". Open notes, open
internet, open VB IDE (you may try out your answer in a program before
you submit it), you may ask me for clarification, you may NOT ask me for the answers,
likewise you may NOT ask
another student
- QUIZ - Visual Basic Quiz program
"vbTipCalculator":
- Design, write, create, test, run, and save
a Visual Basic program to help the user calculate a tip for service
in a restaurant
- Requirements:
- Ask the user the amount of the bill -
textbox object
- Ask the user how good the service was -
Excellent, Good, Fair, Poor - option button objects on a frame
- Suggest (display in a textbox object) a
tip percentage based on service and allow the user to change it:
- Excellent = 20%
- Good = 15%
- Fair = 10%
- Poor = 5%
- Calculate and display (textbox object)
the tip as a percentage of the original bill
- Calculate and display (textbox
object) a total as the original bill plus calculated tip amount
- Ask the user (checkbox object) if the
bill should be rounded up to the next whole dollar amount
- Code the round up checkbox
- Save & Test
- Copy the project and form and any images to
your "H:/vb/vbTipCalculator" folder for me to assess
- Grading Criteria:
- Must give correct answer and all output
specified in requirements above (60 pts)
- Must use correct object and variable
naming conventions (txtSomething and intSomething) (5 pts)
- Must use Option Button object on a frame
to allow the user to select service (5 pts)
- Must have author name, program name, and
date written as comments (5 pts)
- Must have at least one programmer-written
function or sub-routine (5 pts)
- Must use Option Explicit (5 pts)
- Must look good (5 pts)
- LAB - Visual Basic program "vbMagic8Ball"
to simulate the fortune-telling device:
- Create a new Visual Basic executable
"frmMagic8Ball" and "vbMagic8Ball"
- Add a label object with instructions to the
user
- Add a textbox object to accept the user
question
- Add a label object to display the magic 8
ball answer
- Add label objects to identify the question
textbox and answer label
- Add and code a command button object to
[eXit]
- Add variables to the Global section at the
top:
Option Explicit
Dim intRand, intLow, intHigh As Integer
- Write code for the Form_Load() event:
Randomize
intRand = 0
intLow = 1
intHigh = 8
- Add and code a command button object to [Roll] the Magic 8 Ball
intRand = Int(Rnd() * (intHigh - intLow + 1)) + 1
Select Case intRand
Case 1: lblAnswer.Caption = "Your Answer Goes Here"
...
Case Else: lblAnswer.Caption = "Oops"
End Select
- Add more Case and answers for a total of 8
- Save & Test
- Copy the project and form and any images to
your "H:/vb/vbMagic8Ball" folder for me to
assess
|
| 48 |
11/18/05 |
|
Friday - Skills USA, PDP, VB Practice:
"vbSnake" cont'd |
|
- Classroom Discussion -
- End of Marking Period 1
- Check your grades - if you haven't completed
an assignment, you may complete it TODAY
- MATES mid-term exams - please be
respectful and quiet
- Visual Basic online text from samsPublishing.com
- Lab Assignment -
- Visual Basic program "vbSnake", cont'd
- Use "My Documents" or "My Computer" to navigate to and open your
existing Visual Basic "vbSnake" program
- Add a Shape object "shpTail", set top/left = 0, width/height =
200, shape=1-Square, visible=False
- Copy and paste creating a Control Array of "shpTail()" a total
of 50
- In the Form_Load(), in a loop, reset all "shpTail(i)"
top/left/width/height/shape/visible properties
- Add a variable "intTailLength" to control the length of the tail
and initialize it to 5 in the Form_Load()
- 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
- If the snake head hits one of the tail segments, game over
- When the snake head eats food, increment the tail length by 5
and decrement the timer interval by 20
- Save & Test
|