Post on 05-Apr-2018
7/31/2019 Integrated Assignment Booklet
1/81
0
ST. ANNES SCHOOL
Integrated Systems 1205
Student Workbook
Coursewebsitehttp://integrated.scottoosterom.ca
Scott Oosterom
August 2009
Integrated Systems assignment guide. All preliminary assignments and programs from the studenttext are included in this booklet. Additional programs have been included to coincide with the notesthat have been handed out in class. All assignments should be typed and submitted by email, jumpdrive or printed and passed in to the teacher. (scott@scottoosterom.ca)
7/31/2019 Integrated Assignment Booklet
2/81
1
7/31/2019 Integrated Assignment Booklet
3/81
2
TableofContentsASSIGNMENTS.....................................................................................................................................5
Assignment#1TechnologicalDesign.................................................................................................... 6
Assignment#2TechnologicalSystemsModel...................................................................................... 7
Assignment#3InteractionDesignPrinciples........................................................................................ 8
Assignment#4ComparingSoftwareInterfaces.................................................................................... 9
Assignment#5CreatinganInterface.................................................................................................. 10
Assignment#6CreatingaForminVisualBasic6.0............................................................................. 11
Assignment#7PartsofaProgram...................................................................................................... 13
Assignment#8BooleanLogic.............................................................................................................. 14
Assignment#9PlanningandWritingaProgram................................................................................ 16
Assignment#10
Declaring
Variables
...................................................................................................
17
Assignment#11TemperatureConversion.......................................................................................... 18
Assignment#12CalculatingTriangles................................................................................................. 19
Assignment#13FerryCrossings......................................................................................................... 20
Assignment#14LoopingStructures................................................................................................... 21
Assignment#1599BottlesofCokeontheWall................................................................................. 22
Assignment#16MultiplicationTable.................................................................................................. 23
Assignment#17 TicTacToe................................................................................................................ 24
PROJECTS...........................................................................................................................................25
Project#1PlanningandDesigninganInterface................................................................................. 26
Project#2HondaFinanceLoanCalculator......................................................................................... 27
Project#3SoftwareDesignandDevelopment................................................................................... 28
VisualBasic6.0BriefCoursePrograms............................................................................................29
Chapter1:WorkingWithForms............................................................................................................. 29
GettingStarted.................................................................................................................................... 30
ReferencingMe
...................................................................................................................................
30
ChangingFormProperties.................................................................................................................. 31
LabOneScreenSaver....................................................................................................................... 32
Chapter2:AllaboutControls.................................................................................................................. 33
UnderstandingControls...................................................................................................................... 33
7/31/2019 Integrated Assignment Booklet
4/81
3
CodingControls................................................................................................................................... 34
LabOneBlockMover1.1................................................................................................................. 36
BlockMover1.1Solution.................................................................................................................... 37
LabTwoAnimatedCircles1.1.......................................................................................................... 37
AnimatedCirclesSolution................................................................................................................... 38
Chapter3:AddingMenus....................................................................................................................... 39
AddingaMenu.................................................................................................................................... 39
CreatingPopupMenus....................................................................................................................... 41
CodingMenuChoices......................................................................................................................... 41
AddingMenuDividers......................................................................................................................... 42
DynamicallyModifyingMenus........................................................................................................... 42
LabOne
Using
Menus
......................................................................................................................
42
UsingMenusSolution......................................................................................................................... 43
Chapter4:WorkingwithVariables......................................................................................................... 44
CountingSeconds................................................................................................................................ 44
NameParser(Workingwithstrings)................................................................................................... 45
LabOnePEClass.............................................................................................................................. 46
PEClassSolution................................................................................................................................. 46
Chapter5:InputandFeedback............................................................................................................... 47
MessageBoxExampleForm............................................................................................................... 47
LabOneMyFavourites.................................................................................................................... 49
MyFavouritesSolution....................................................................................................................... 49
Chapter6:LogicandLoops..................................................................................................................... 50
TimerExample.................................................................................................................................... 50
ThePasswordProgram....................................................................................................................... 51
MultipleChoiceQuestion................................................................................................................... 52
Do
While
Counter
.............................................................................................................................
53
SystemShutdown............................................................................................................................... 54
ASCIICharacterconverter................................................................................................................... 54
LaboneIncrementProgram............................................................................................................ 55
IncrementProgramSolution............................................................................................................... 55
LabTwoDayofYear......................................................................................................................... 56
7/31/2019 Integrated Assignment Booklet
5/81
4
DayofYearSolution............................................................................................................................ 56
Chapter7:Arrays,Dates,andRandomization........................................................................................ 57
ArrayofMonths.................................................................................................................................. 57
CommandButtonArray...................................................................................................................... 58
CardShark1.1..................................................................................................................................... 59
DestinationsUnlimited....................................................................................................................... 61
VideoWorld........................................................................................................................................ 62
LabOneMagic8............................................................................................................................... 64
Magic8Solution................................................................................................................................. 64
LabTwoConneRiverLotto.............................................................................................................. 65
ConneRiverLottoSolution................................................................................................................. 65
Chapter8:
Working
with
Procedures
......................................................................................................
66
PersonalityComputer......................................................................................................................... 66
ReversalofFortune............................................................................................................................. 67
AddingSplashScreens........................................................................................................................ 67
LabOneAnnoyingSplashScreens................................................................................................... 68
Chapter9:MDIForms,Modules,andMiscellany................................................................................... 69
WorkingwithMDIChildren................................................................................................................ 69
WindowedLists................................................................................................................................... 70
SystemMemoryCheck....................................................................................................................... 71
ShellingOut......................................................................................................................................... 72
LabOneMDIChildren...................................................................................................................... 73
Chapter10:Accessingdata..................................................................................................................... 73
ReadingASCIIFiles.............................................................................................................................. 73
CreatingASCIIFiles.............................................................................................................................. 74
AppendingtoASCIIfiles...................................................................................................................... 74
AddressBook
......................................................................................................................................
75
INTEGRATEDSYSTEMSPROGRAMMINGPROJECTGRADINGRUBERIC................................................78
Disclaimer..........................................................................................................................................80
7/31/2019 Integrated Assignment Booklet
6/81
5
ASSIGNMENTS
Valueforthissection:25%
7/31/2019 Integrated Assignment Booklet
7/81
6
Assignment # 1 Technological Design
Begin by reading over the notes entitled What Is Technology?
PartAExplore several of the designs at the design museums located at the website below. Taketime to study each design carefully. Using Microsoft Word, identify six (6) differentproducts, their use or function, and the problem it was likely designed to solve.
http://cooperhewitt.org/COLLECTIONS/product_design.asp (click view collection online)http://www.designmuseum.org/discoverdesign/
PartBThe purpose of this activity is to think about technologies in the broader sense and to
classify technologies into one of the three major categories.
Examine the technologies used in your school. Remember that technologies are knowledge,processes and products. That means that you need to think about what is done, how it isdone, the knowledge required to do it and the tools and equipment employed in doing it.Keep in mind that every activity in the school (almost) is a technological activity.
o Create the table below in Word and make a list of10technologieso For each technology, identify the primary output of the technology (information and
knowledge, physical product, or bio product)o Classify each technology as one of Informational (communications, management, or
control), Physical (production, construction, transportation, exploration), or Bio(aquaculture, agriculture, silvaculture, medicine, genetics, and sports). Don't forgetthat there may also be physical systems of power or transportation.
Technology PrimaryOutput ClassificationEX. Basketballnets Physicalproduct Biotechnology
7/31/2019 Integrated Assignment Booklet
8/81
7
Assignment # 2 Technological Systems Model
Review the notes entitled Technological Systems Model
Using Word:
Identify a store in your neighbourhood, such as the gas bar or John Ns List all the systems that are in the store, including the building itself and things like
coolers For each system, make the following determination
o Its purposeo Its inputso If there is feedback (closed loop or openloop)o Its processeso Its output(s)o Its outcomes
There are several examples in the notes
7/31/2019 Integrated Assignment Booklet
9/81
8
Assignment # 3 Interaction Design Principles
BeginbyreviewingthenotesentitledInterfacesandVisualDesignoninteractiondesignprinciples.
Find10devices(anysizeorfunctionfromapenciltoanairplane)thatyouorsomeoneelseuses
regularly.Identify
the
purpose
of
the
device,
and
the
controls
or
mechanisms
used
to
operate
the
device. Usingthe7principlesofinteractiondesigninthelesson,assesstheinteractiondesignrateeach
deviceoneachprinciplefrom1(poor)to4(good),usingatablelikethisone.
DEVICES
INTERACTIONDESIGNPRINCIPLES
Directness
Userin
control
Consistency
Forgiveness
Feedback
Aesthetics
Simplicity
Example:TVremotecontrolControlsTVfromsofa
4
2
4
2
3
4
4
7/31/2019 Integrated Assignment Booklet
10/81
9
Assignment # 4 Comparing Software Interfaces
Begin by reviewing notes entitled Software Interfaces
Open a window for several different programs on your computer:
Microsoft office Word Wordpad (Start programs Accessories) Notepad Visual Basic 6.0 FireFox or Internet Explorer (or both if they are installed) Paint
For each program above:
1. State the purpose of the program2. Compare the menus that are similar between the programs. Does each allow you to do
similar things? Different things?3. Looking at the menus that are different between the programs. How do they reflect the
purpose of the program?4. Comparing: Paint, Word, Wordpad and Notepad because they each allow you to enter and
edit text, how different (if at all) is the process between programs? Is each suited to largeamounts of text or only small amounts? Is it easy to copy text from one program to another?
5. Comparing Paint and Word because they both can be used to draw pictures, what do thetwo programs have in common? Which program is best suited for its purpose and why?
AnsweronlyifFireFoxandInternetExplorerarebothfoundonthecomputer6. Comparing FireFox and Internet Explorer because both are web browsers, what do both
programs have in common? What features does one program have that the other does not?
As a point of interest take a look at the website below to see how the Windows interface haschanged over the years: http://www.harding.edu/fmccown/gui/guitour.html
7/31/2019 Integrated Assignment Booklet
11/81
10
Assignment # 5 Creating an Interface
Reviewallnotesoninterfacedesignifnecessary.
Usingthepaperprovideddrawthefollowinginterfaces. Besuretoconsiderthedesignprincipleswhen
youare
doing
your
drawings.
Identify
any
buttons,
wheels,
dials,
sliders,
etc
as
such
on
the
diagram.
1. Draw(tothebestofyourknowledge)anold1950sstylefloormodeltelevisionuserinterface.
2.Drawa1990sstyletelevisionuserinterface
3.Drawa2009styletelevisionuserinterface.
4.Designauserinterfaceforatelevisionyouthinkmayexistin50yearsfromnow.
Inyournotebook
Howhastheuserinterfaceforthetelevisionchangedinthelast60years?Explain
Areanyaspectsthesame?Explain
Inyouropinion,hastheuserinterfaceforthetelevisionimprovedtomakethemeasiertouseor
moredifficulttouse? Explainyourreasons.
Submityourdrawingsandyournotebooktogether.
7/31/2019 Integrated Assignment Booklet
12/81
11
Assignment # 6 Creating a Form in Visual Basic 6.0
StartVisualBasicandclickonOKtoopentheStandard.EXEproject. VisualBasicwillopenwitha
Project1 Form1(Form)windowandaformcalledForm1init.
Click
on
the
form
to
select
it.
LookatthePropertiesWindow.
ItshouldsayProperties Form1atthetop,andimmediatelybelowit,inasmallwindow,Form1 Form.
Belowthat,youshouldseetwotabs,Alphabetic,andCategorized. Alphabeticshouldbeselected. The
Alphabetictabmakesiteasytoquicklyfindapropertywhenyouknowitsname. TheCategorizedtab
makesiteasytosetpropertiesinrelatedgroups.
Thewindowbelowhastwocolumns. TheleftcolumnistheProperty,andtherightcolumnistheValue,
orsetting
that
the
property
has.
AttheverybottomofthePropertiesWindow,youwillseeasmallerwindowthatgivesadescriptionof
thepropertythatiscurrentlyselected. IntheexamplebelowitisCaption.
Clickonthefirstproperty,(Name). Readtheentryinthebottomwindow. Usingthedownarrow
cursorkey,stepdownthelistofproperties,readingthedescriptionofeach.
ClickontheCategorizedtab. Thiswillorganizethepropertiesunderheadings. Scrolldownthelist
againandmakeanoteoftheheadings. Togetabetterviewofthecategoriesofbehaviours,clickthe
signto
the
left
of
each
heading
to
collapse
the
list.
Do
the
properties
make
more
sense
when
they
are
listedinthesecategories?
ExpandtheAppearancecategorybyclickingonthe+signtotheleft. Changethefollowingproperties
BackColor(Notethespellingiscolor,notcolour. VisualBasicwillnotunderstandcolour).
ClickonBackColor. Thevaluecolumnhasalittleboxwiththecolourgreyinitandthehexadecimal
number&H000000F&,andasmalldownarrowontheright.
Clickonthedownarrow. Asmallwindowwillappear,withtwotabsPaletteandSystem.
Click
on
Palette.
Click
on
acolour.
Note
the
change
to
the
form.
Also
note
the
change
in
the
property
valueforBackcolorinthepropertiesWindow. Don'tlikethecolour? Changeitagain.
Caption. Thisisthelabelthatwillbeintheobjectstitlebar. BydefaultitisForm1,forthisform.
ClickonCaption. Nothinghappened!Nodropdownarrowthistime.
7/31/2019 Integrated Assignment Booklet
13/81
12
ClickinthevaluecolumnonthevalueForm1. Deletethewordandtypeinanewword. Becreative.
Presstheenterkey.Whathappenedtotheform?
Name. TheNamepropertyisappliedtotheProjectWindow.
ExpandtheMisccategory.
Clickonthe(Name)property.
DoubleClickontheNameValue(Form1)toselectit. Typeinanewnameforthevalue. Becreative.
Presstheenterkeywhenyou'redone. Whathappenedtothelabelatthetopoftheprojectwindow?
Changeitagain.
TosavetheVisualBasicprogramtoyourz:\drivefollowtheseinstructions
FirstgotoMyComputerandgointoyourZ:drive (z:\yournameonNiskam). CreateaNewFolder
calledINTEGRATEDSYSTEMS1205(YouwillsaveALLyourprogramsintothisfoldersothatyoucan
accessthem
from
other
computers).
NowinVisualBasic
Click|File|SaveProjectAs|
ASaveFileAswindowwillopen.
Selectz:\(yournameonNiskam)fromthedropdownmenuatthetop. Doubleclicktoenterthe
INTEGRATEDSYSTEMS1205folderthatyoujustcreated.
Click
on
the
Save
button
TheFormwillbesaved(itwillhavethenameyougaveitinproperties)
ASaveProjectAswindowwillappear. ThelocationshouldbethesameintheSaveInwindow. Check
theFilename. Ifitisnotthesameasthenameoftheform,renameittobethesame. Notethatithasa
differentextension(vbpforvisualbasicproject)
ClickonSave
7/31/2019 Integrated Assignment Booklet
14/81
13
Assignment # 7 Parts of a Program
ReviewnotesentitlesPartsofaProgram
PartA
Identify each of the following by its formal name by indicating to which category it belongs.
Example:The + sign is a mathematical (or arithmetic operator)
1. OR2. 56. Dim Name $ as String7. For J = 1 to 108. Let X = 79. Do....Loop10.Let X = A + B
PartB
There are three basic parts to any computer program. Name the parts and give a brief descriptionof what each part does.
Submityouranswers
7/31/2019 Integrated Assignment Booklet
15/81
14
Assignment # 8 Boolean Logic
ReviewnotesentitledBooleanLogic
Thisassignmentmaybecompletedinyournotebook.
Example:
Sayyouwenttothestoretobuybeer(A)andcigarettes(B).(thisisafactoneyourparentstoknow
about)
Thenyourmothercallsyourcellandaskswhatyouboughtatthestore.Youhavefouroptions,butonly
oneistrue.Youcantellher:
ENGLISH BINARY TRUTHTABLE
A | B |AANDB
MilkANDeggsAlie 0 AND 0 0 0 | 0 | 0
MilkANDsmokesAlie 0 AND 1 0 0 | 1 | 0
BeerANDeggsAlie 1 AND 0 0 1 | 0 | 0
BeerAND
Smoke
Truth
1AND
1
1
1|1|1
Theonlywaytobetruthfultoyourmotheristotellthetruthaboutbothitems.
PartA
Completeatruthtableforeachofthefollowingsetsofstatements.Becarefultoensureyouchoosethe
correctoperator.
i.IdentifypartsofeachstatementasAorBorC(ifneeded)
ii.Drawthetruthtableasshownabove.
1.IstarttosweatwhenitishotoutsideorIamworkingout.
2.Alicewantstohavepeanutsandwhipcreamonhericecreamsundae.
3.HurricaneBillbroughtraintoConneRiver.
4.Frankisadiabeticcandrinkneitherpopnormilkshakes.
5.Johnalwaysusesanumbrellawhenitrainsbutnotwhenitsnows
Part
B
Logicgatescanbeconnectedtogethertoformallkindsofusefulcircuits. Usingtherespectivetruth
tablefindtheoutputvalueQ(itwillbea0or1)foreachofthefollowing.(Hint:findtheoutputforeach
ofthegatesontheleft. Thisoutputthenbecomestheinputforthenextgate.)
7/31/2019 Integrated Assignment Booklet
16/81
15
1.
2.
3.
7/31/2019 Integrated Assignment Booklet
17/81
16
Assignment # 9 Planning and Writing a Program
Computerprogramsareusuallywrittenasthesolutiontosomeproblemthatamachinecansolvefaster
(andsometimesbetter)thanahuman. Likeanyproblemsituation,thesolutionshouldbewellthought
outin
advance.
Visual
Basic
programs,
from
the
simple
to
the
most
complex,
require
some
degree
of
planning.Wearegoingtolookatthestepswhichstartwithaprogramideaandendwithanexecutable
programthatcanrunonanycomputerwhichhasWindowsastheoperatingsystem.
TheProgramIdea
Afteralotofseriousapplicationssuchasmilitary,business,andscientific,programmersturnedto
entertainment. Todaygameprogrammingisamultimilliondollarindustry.Wewillcreateaprogramto
playasimplegame(nofancygraphics,sorry:))
Theprogrammingproblemistocreateaprogramthatcangeneratearandomnumberandhavethe
userguess
that
number.
If
you
play
this
type
of
game
long
enough
you
will
probably
find
the
secret
to
guessingthecorrectnumberinaminimumofguesses.
ProgramSpecs:
Theprogramshouldgeneratearandomnumberbetween1and100 Therehastobesomewayfortheusertoenteraguess Thecodewillcomparetheguessandtherandomnumber Dependingontheguess,theprogramshouldgenerateappropriatemessages Thereshouldbeawaytoendtheprogram
ThePlan
BecauseVisualBasicisgraphicalinnaturewewilldividetheplanningintotwomajorparts
PlanningtheGraphicalInterface PlanningtheCode
PlanningtheGraphicalInterface
Youcanplanaroughlayoutofthecontrolsbysketchingonapieceofpaperorifyouareinfrontofa
computer,trylayingoutthedesignonanewprojectform. Eitherway,youneedtothinkaboutthe
number
of
controls
and
their
function
in
your
project.
After
some
thought,
we
conclude
that
we
need
thefollowingcontrols.
7/31/2019 Integrated Assignment Booklet
18/81
17
Assignment # 10 Declaring Variables
ReviewnotesentitledDeclaringVariablesandpages7276intextbook.
Typeandsubmitthisassignment.
Foreach
of
the
following
write
the
dim
statement
to
declare
avariable
to
store
the
information.
Be
sure
toincludethe3letterprefixatthebeginningofyourvariablename.(Note:yourtextbookdoesnot
includetheseprefixes,andyouwillnotbeexpectedtoincludetheminallprograms,onlythoseyouare
writingonyourown.
ex. TostorethevolumeofMonsterEnergydrinkinacan.
dimint_volumeasInteger
1. Marksonyourassignments2. Thedistancefromearthtothemooninkilometres3. Thepriceofachickenfingerdinneratthearcade4. ThedateandtimeofaflightfromSt.JohnstoHalifax5. Youfirstname6. ThenumberofpeoplelivinginNewfoundland7. Theanswertotrueandfalsetestquestions8. Yourbirthdate9. Costofanewlaptopfordoingyourprogrammingon10. Thedistancefromearthtotheothersideofthemilkwaygalaxyinkilometres11.NameofyourfavouriteCD12.Percentdiscountonanewskidoo13.Possiblestatesorpositionsofalightswitch14.ThenumberofstudentsatSt.Annesschool15.Thelengthoftimebeforeclassisover
7/31/2019 Integrated Assignment Booklet
19/81
18
Assignment # 11 Temperature Conversion
WriteasimpleprogramthatwillallowausertoenterthetemperatureindegreesFahrenheit(F)into
onetextboxandconvertittodegreeCelsius(C),withtheanswerbeingdisplayedinasecondtextbox.
Youwill
need
to
include:
4commandbuttons: CelsiustoFahrenheit,FahrenheittoCelsius,Clear,andExit 2or4textboxes(dependingonhowyouchoosetodesignyourform) Labelswhereneeded(Title,directions,etc.)
Theformulas:
F=Fahrenheit C=Celsius
C = 5/9*(F 32) F=9*C/5+32
Youwill
need
to
submit:
Form Code Showteacherthattheprogramisworking
OPTION: Copyallprogramfilestotheteachersjumpdrive. Thiswillsavepaper,andallowthe
teachertoseetheworkingprogram.
Hint: Keepinmindthetypesofvariablesyouwillneetostorenumbersliketemperature.Willintegers
begoodenough,orwillyouneedtouseabettertype?
7/31/2019 Integrated Assignment Booklet
20/81
19
Assignment # 12 Calculating Triangles
Writeaprogramtocalculatethefollowingcharacteristicsofatriangle.
HypotenuseC2=B2+A2(So, ) AreaArea=
orArea=
PerimeterSideA+SideB+SideC
Yourprogramshouldhavetextboxesfortheusertoentertheinformationforthetriangleandcommand
buttonstodoeachcalculationbasedonthedatatheuserentered.
Youshouldincludeaclearbuttonandanexitbutton.Clearwillresetallthetextboxestoblank:
Text1.text=
TheExitbuttonwillclosetheprogram.
Youshouldincludeadiagramofthetrianglesimilartotheoneabovesotheuserknowswhichtextbox
representswhichsideofthetriangle. Youwillalsoneedatextboxtodisplaytheanswerforeach
calculation. Alltextboxesshouldbeproperlylabelled.Yourformdoesnotneedtobeexactlyasshown.
Becarefulwhennamingyourvariables.
Youwillneedtosubmit:
Form Code Showteacherworkingprogram
OPTION: Copyallprogramfilestothe
teachersjumpdrive. Thiswillsave
paper,andallowtheteachertoseethe
workingprogram.
7/31/2019 Integrated Assignment Booklet
21/81
20
Assignment # 13 Ferry Crossings
YouareworkingforMarineAtlanticwhenyourbossasksyoutowriteaprogramthattravellerscanuse
todeterminethecostoftheircrossingsfromPortauxBasquestoNorthSydney. Theprogrammust
allowtheusertoselectwhethertheyareanadult,child,etc.;thetypeofvehicletheyaretravellingon,
andthe
type
of
accommodations
they
wish
to
have
during
their
voyage.
The
table
below
shows
all
the
ratesforeachcategory. TheusermustselectoneoptionfromeachsectionandclickonaComputer
pricebuttontodeterminetheirtotalcostoftravel.
Passengers Price
Adults 13 -64 $28.75Children 5 12 $14.50Children 4 and under FreeSeniors 65+ $26.25
Vehicle Type Price
Cars / Pickups up to 20 $81.50Motorcycle / ATV $41.25
Bicycle $12.75None FREE
Accommodation Type Price
No Cabin FREE4-Berth Cabin (Day) $44.954-Berth Cabin (Night) $111.75Reserved Seat $9.95
Forthisprogramyouwillrequireoptionbuttonsforeachcategoryabove. Choosingthreeoption
buttonsandpressingcomputewilladdupallthepricesanddisplayitinatextbox.Youshouldincludea
clearbuttonandanexitbuttonaswell.
Bonus: Onceyougetyourprogramworkingforonecustomer,youmayconsideraddingthetextboxes
toyourformfortheusertoenterthenumberofeachtypeofpassenger.Defaultnumbershouldbe
zero,requiringtheusertochangeeachtooneormore. Doingthis,willrequiresomevariablestokeep
trackofthenumberofeachpassengerandaddupalltheirtotals.
Hint:YouwillrequiretheuseofseveralIfThenelsestatementsinordertoproperlycomputethe
totalcost. Thereareseveralwaystogoaboutthis,sodonobealarmedifsomeoneelsedidit
differently,aslongasitworks.
Example: 1adultpassenger+1car+nocabin =$28.75+$81.50+$0.00= $110.25Total
Youwillneedtosubmit:
Form Code Showteacherworkingprogram
OPTION: Copy all program files to the teachers
jump drive. This will save paper, and allow the
teacher to see the working program.
7/31/2019 Integrated Assignment Booklet
22/81
21
Assignment # 14 Looping Structures
Part1 Instructions: Foreachofthefollowingloops,brieflydescribewhatwillhappenifthecodeis
executed.
1.
2.
3.
4.
5.
Part2Instructions:Foreachofthefollowing,writetheloopingstructurecode.
6. Createaloopthatcancountto100000000(onehundredmillion)instepsof150.Theloopshoulddisplaythecurrentnumberinatextbox.Thereshouldalsobeashortpausebetween
numbers.
7. Createaloopthatcountsbackwardsfrom50to0.Thefirst from50to26shouldappearinText1and25downtozeroshouldappearinText2.(Thisshouldbedonewithoneloop,nottwo)
7/31/2019 Integrated Assignment Booklet
23/81
22
Assignment # 15 99 Bottles of Coke on the Wall
Writeaprogramthatwilldisplaythehighlyrepetitivelyricstothesong99BottleofCokeonthewall.
Theusershouldbeabletoenterthestartingnumberintoasmallertextboxthenclickabuttonto
displaythelyricsinalargertextbox. Becarefulwiththelyrics,becausetheyrepeat97timesthen
changefor
the
last
two
verses
of
the
song
as
noted
below.
2bottlesofcolaonthewall
2bottlesofcola
Takeonedownandpassitaround
1bottleofcolaonthewall Bottlesbecomesbottle
1bottleofcolaonthewall Bottlesbecomesbottle
1bottleofcola
Takeonedownandpassitaround
nomore
bottles
of
cola
on
the
wall
Entire
last
verse
changes
Gotothestore,buysomemore,3bottlesofcolaonthewall
Youwillneedtouseacombinationofloopingstructures,aswellasIfThenElseconditional
statements.
Hint:Getyourprogramworkingstraightthroughfrom99to0bottles,thenmakethechangesandaddIf
statementstocorrectthelyrics. AttheendofeachlineoftextwecanusethekeywordvbNewLineto
gotoanewlineinatextboxwithMultiLinesettotrue.
Examplecode: Text2=Text2+Str(x)+"bottlesofcola."+vbNewLine
Youwillneedtosubmit:
Form Code Showteacherworkingprogram
OPTION: Copy all program files to the teachers
jump drive. This will save paper, and allow the
teacher to see the working program.
7/31/2019 Integrated Assignment Booklet
24/81
23
Assignment # 16 Multiplication Table
Writeaprogramthatwilldisplayamultiplicationtableinalargetextbox,asshownbelow.
Yourformdoesnotneedtobe
identicalto
this
one.
You
may
havetheprogramdisplaythe
timestableuponloadingthe
program(noneedingbuttons)
oryoumaychoosetohavethe
userenterintotextboxeswhich
timestablestheywishto
displaytodisplay.
Youwillrequire2ForNextloopingstructuresinordertocountanddisplayeachlineofthe
multiplicationtable.
Hint: TogeteachlinewecanusethekeywordvbNewLineattheendofourcodestatement. Tolineup
thecolumnsastheyareinthefigureabove,wecanusethekeywordvbTab.Thiswillforcetheprogram
toentertheequivalentofpressingtheTabkeyonthekeyboard.Besuretomakeyourtextboxlarge
enoughtodisplayallthecolumnsofthetable.
Youwillneedtosubmit:
Form Code Showteacherworkingprogram
OPTION: Copyallprogramfilestotheteachers
jumpdrive. Thiswillsavepaper,andallowthe
teachertoseetheworkingprogram.
7/31/2019 Integrated Assignment Booklet
25/81
24
Assignment # 17 - Tic Tac Toe
Instructions
DevelopafullyfunctionalTicTacToegame.Writethepseudocodefollowingtheguidelinesgiveninthe
notesand
develop
your
form
ProgramSpecs:
9commandbuttonsforgameplay Exit,NewGameandResetWinsbutton MenuwithExitandHelpoptions Programmustkeeptrackofwhoseturnitis
andtelltheplayerswhentogo.
Programshouldkeeptrackofhowtimeseachplayerwinsandkeeptrackofthe
scoreinatextboxforeachplayer
TheAvailablebuttonsshouldchangetoanXorOdependingonwhoseturnitisand
becomedisabledsoitcannotbepressed
again.
Yourcodeshouldbefullycommented,asshownbelow,sothatyourcodeisexplained.
Hints:
Whattypeofvariablewithonlytwopossiblevaluescouldbeusedtokeeptrackofturns? SavetimebyusingacontrolarrayforyourgameplaybuttonsORcreateaproceduretobe
calledinthecodeforeachbutton.
BeLogical Thinkaboutwhatyouwanttheprogramtodoateachstepwhenyoupressabutton
Getsectionsofcodeworking,thencopyandpastetomakeprogrammingforfaster.You
will
need
to
submit:
Form Code Showteacherworkingprogram
OPTION: Copy all program files to the teachers
jump drive. This will save paper, and allow the
teacher to see the working program.
7/31/2019 Integrated Assignment Booklet
26/81
25
PROJECTS
Valueforthissection:40%
7/31/2019 Integrated Assignment Booklet
27/81
26
Project # 1 Planning and Designing an Interface
Reviewallnotestodate.
Tobecompletedingroupsof2or3
1. Brainstormalistof9potentialproblemsthatcanbesolvedusingtechnologyYouwillbegradedonthecompletenessofthislist.Betweenthepeopleinthegroupyoushouldbeabletocomeupwith9possibleproblems. Note,youdonotneedtobeabletosolveallof
theminclass,youarejustcomingupwithideas
EXAMPLE: Wateringplantstoautomaticallywaterplantsatacertaintimeofday
Provideashortexplanationofoneortwosentencesforeachideatoclarifyexactlywhattheproblemis
Youmayuseexistenttechnologytosolvetheproblem,buttrytocomeupwithideasthathavenotbeensolvedyet,orfindotherwaystosolvethem.
5marks 2. ForEACHideawriteashortparagraph(notoneortwosentences)discussingtheimpacteach
willhaveonhumanactivity.
Comeupwithrealisticimpactsthateachproblemhasonsocietyandhumanactivity.Arethey
negativeimpactsorpositiveimpacts?
10marks
3. Asagroup,selecttheTHREEbestideas.Foreachofthesethreeideas,identifyotherpossibleoptionsforsolvingthisproblem.
Foreach
idea
in
step
one,
you
should
have
come
up
with
asingle
way
to
solve
the
problem.
In
thisstep,youshouldLISTandDESCRIBEatleasttwootheroptions.
Thisshouldtake12classesifyoueachtakeoneofthethreeideas 5marks
4. Asagroup,decidewhichofthetopthreeideasisthebestanddevelopastepwiseproceduretosolvingtheprobleminreality.
Thisisthebiggeststep.Youneedtofigureouthowbesttosolvetheproblem,eitherusingone
oftheoptionsdecidedonforthisproblemfromstep3,byusingsomecombinationofthem,or
byusinganewsolution.
Youmustdescribe,INDETAIL,whatyouwillbedoingtosolvethisproblem.o Doesanythingneedtobebuilt?Isitusingmaterialsthatalreadyinexistence?How
willyoubuildit?Who(maybe)willbuildit?
o Moredetailswillbeprovidedwhenwegettothisstepsoyoucangethelpwithit. 15marks
7/31/2019 Integrated Assignment Booklet
28/81
27
Project # 2 Honda Finance Loan Calculator
SoyouwanttobuyanewHondaCivic,butdonthavethemoney.Letsassumeyoudecidetoborrow
themoney
from
Honda
Finance.
We
want
to
determine
how
long
it
is
going
to
take
to
pay
off,
given
a
monthlypayment.
Makethefollowingassumptions:
Theinterestrateisenteredasanannual(yearly)ratedivideby12formonthlyrate TheloanistakenoutonJanuary1stoftheyear Interestisaddedattheendofthemonth,justbeforethepaymentismade Paymentisappliedattheendofamonth,justaftertheinterestisapplied Loanispaidoffwhenthebalancegoestozeroorbelowzero
Writeafully
commented
visual
basic
program
to
solve
the
problem.
Create
aform
that
will
allow
the
usertoinputtheamountoftheloan,theinterestrate(asapercent),andthemonthlypaymentamount.
Havetheprogramdisplaythemonthlybalanceandthetimelefttopayofftheloaninamultilinetext
box.Yourprogramshouldincludeaprintbuttonsotheusercanprintouttheoutputthatisinthe
textbox. Checkyourbookfordetailsonprinting. IncludeaClearbuttontocleartheform.
Warning:Ifthepaymentisnotlargeenoughtocovermorethanthefirstmonthsinterest,theloan
willneverbepaidoff. Besuretoincludeamethodoftellingtheuserthattheyneedtoenterahigher
payment (ex.Usingapopupmessage,sotheusercanquicklycloseitandenteranewpayment)
Youneed
to
submit
the
following:
1. PseudocodeUsethetemplategiveninclass2. Codecompletewithcommentsandproperindentations3. FormcompletedinVB4. Enterthefollowinginformationandprintoutthedetails.
Loanamount: $25,000.00 Interestrate:5% Monthlypayment:$200.00
Loanamount: $25,000.00 Interestrate:5% Monthlypayment:$100.00
HINT:
Makethemostofyourclasstime,writeyourpseudocodeanddrawyourformathome.Attemptto
writetheactualcodeaswell,bugscanbeworkedoutinclass.
7/31/2019 Integrated Assignment Booklet
29/81
28
Project # 3 Software Design and Development
ImaginethatyouareworkingforMicrosoft,orevenGoogle;youhavebeenaskedtodevelopsomething
newandimprovedthatthecompanycanmarket.Youwillbegoingthroughtheentiresoftware
developmentprocess,asitisoutlinedbelow,towriteyourownprogramfromstarttofinish.
Tobecompletedingroupsoftwo(orthreeifnecessary)
Part1:WrittenProposal(Approx.time:1class)
Theproposalshouldoutlinethebackgroundandreasoningforyourprogramidea.Youalsoneedto
indicateyourtargetaudiencewhoisyourprogramgoingtobefor?Forexample,considerwhetherit
willbeusedprimarilybychildren,orifyourprogramwillaimmoretowardseducatorsorbusiness
people.
Describethepurposeofyourprogram.Forwhatwillitbeused?Howmightitbebetterthantheother
optionsthat
are
available?
Outlinethefunctionsofyourprogram.Whatwillitbeabletodoandhowwillitdoit?Beasdetailedas
possible.Willyouhavemenusthatdrivetheprogram,orwillbuttonsbeused?Willyoubeusing
externalfiles,readinginformationintotheprogramfromanASCIIfile,orsavinginformationintofiles?
Part2: FormdevelopmentDiagrams(Approx.time:2classes)
Drawyourformsbyhand,neatlyandinpencil.Thisdiagramwillbeusedasaguidelinefortheformyou
willmakeonthecomputer.Youmayfindthatitdoesnotworkthewayyouhavedrawnit,anditneeds
tobemodified. Thisshouldbedoneusingafullsheetofblankpaper,andoutliningallthespecificsof
buttons,labels,
text
boxes,
etc.
If
you
are
using
asplash
screen,
or
MDI
child
forms,
draw
them
too.
Part3:SpecsandPseudocode(Approx.time;2 3classes)
Followingtheguidelinesfromclass,writeuptheprogramspecificationsandpseudocode. Remember,
yourpseudocodeisinEnglish,describingwhatcodewilldoasitrunsthroughtheprogram,oraseach
buttonispressed. TheSpecsareasingleparagraphstatingthespecificsoftheprogramfunction.
Part4:CodingandProgram(Approximatetime: 4+weeksofclass)
Yourcodeshouldbewritteninalogicalmanner.Makesureallyourcodeisfullycommentedsothata
readercantellwhatparticularlinesofcodearebeingusedfor.Followtheexamplesprovidedinclassfor
commenting.
Takeadvantageofallthetechniquesyouhavelearnedinthecourse.Usearrays,proceduresor
functionsinordertomakethecodeshorter. Iftherearepartsoftheprogramthatyouarestuckon,talk
toyourteacher.
Seethegradingrubricattheendoftheendofthisbookfordetailsonhowtheprojectwillbegraded.
7/31/2019 Integrated Assignment Booklet
30/81
29
VisualBasic6.0BriefCourseProgramsValueforthissection:15%
Allprograms
from
the
student
textbook
that
need
to
be
completed
are
in
this
section.
Many
programs
in
thebookhavetyposthatpreventtheprogramsfromfunctioningproperly,ifatall.Somesectionswill
requireyoutolookinthetextforcode.
1. Completeallprogramsasyouworkyourwaythroughthetextbook. Allfigurenumbersintheinstructionhereinrefertothetextbook.
2. Answerallofthequestionsattheendofeachchapter Answerscanbefoundbyreadingthechapters Youmayanswerthesequestionsinyournotebook
3. Uponcompletionofeachchapter,showtheteacherthattheprogramsareworkingandthatyourquestionsarecompletedbeforemovingontothenextchapter.
Questionsmaybedoneathome Allprogrammingwillbedoneduringclasstime
Note:ItisrecommendedthatyoucreateanewfolderonyourZ:\driveforeachchaptersothatyoucan
easilykeeptrackofallyourprograms.Ifnot,pleasenameprojectsaccordingtowhattheyare.
Chapter 1: Working With Forms
7/31/2019 Integrated Assignment Booklet
31/81
30
GettingStartedPage4intext
1. OpenVisualBasic6.0(StartProgramsMicrosoftVisualStudio6.0MicrosoftVisualBasic6.0)
2. Youmustchoosewhetheryou areopeninganewprojectoranexistingone,asillustratedinFigure1.1 choose,New,StandardEXE.
3. VisualBasicnowloadsasshowninfigure1.2.a. OntheleftistheProgramcontroltoolbox,usedaddfeaturestotheformb. Ontheright isthepropertieswindowc. Inthemiddleistheformthisiswhereyouwilldesignyourprogram
Page5intext
1. MakecertainthatthehighlightisonitsdefaultlocationofCaption.Ifitisnot,doubleclickthecaptionpropertyinthepropertieswindow.
2. TypeHelloworldandpressentera. Thecaptionoftheformnowreflectsthischange
3. PressF5orclicktheplaybuttonorselectrunfromtherunmenua. Thisrunsyourprogram
4. ClicktheXtoclosethewindow.
ReferencingMePage6intext
ToreferenceForm1(yourform)youcansimplycallitForm1oryoucanusetheinternalkeyword:Me
1. DoubleclicktheForm.Acodewindowappearswithtwolinespresent,oneaboveandonebelowwhereyourcursorissitting.
2. Typein:Me.caption=BuddysCarpetwillnotbeundersolda. NoticehowVisualBasictriestoguessthekeywordyouwishtouseasyoutypeit.You
caneitherscrollthroughthelist orcontinuetypingmanually
b. Alsonoticethetexthasquotationmarksaroundit3. ClicktheXinthecornerofthecodewindowtocloseit. Runtheprogram.
a. Thecaptionwillchangewhentheprogramisrunning4. ClosetheprogrambyclickingtheX.
7/31/2019 Integrated Assignment Booklet
32/81
31
5. DoubleclicktheFormtoreopenthecodewindow.6. Changethelineyouhadenteredtoread:Me.caption=Date
a. Dateisafunctionanddoesnotrequirequotationmarks7. Runtheprogramandnoticehowthecaptionbecomestodaysdatewhen.8. ClickXtoclosetoprogram
ChangingFormPropertiesPage7intext
Tochangetheformfromgreytored,followthesesteps:
1. DoubleclickBackcolorfromthepropertieswindow,twotabswillappear,SystemandPalette.2. ChoosetheSystemtabandthenselectwindowframefromthelist3. ChoosethePalettetab,andthepickashadeofred.4. Runprogram.Itshouldnowresemblefigure1.4.5. Xoutofprogram
Page8intext
Theenabledpropertydetermineswhetherauserwillbeabletointeractwiththeformwhenthe
programisexecuted.Toillustrateitspowerfollowthesesteps:
1. DoubleclicktheEnabledpropertytochangethedefaulttruevaluetofalse.2. Runprogram.3. TrytoclickXtoclosetotheprogram. Yourattempttostoptheprogramisignoredbecause
EnabledissettoFalse.Youarenotabletointeractwiththeform.
4. FromtheVisualBasicwindow,PressstoporchooseEndfromtheRunmenu.5. DoubleclicktheEnabled propertytosetitbacktotrue.
Page9intext
Theheightpropertydefinestheverticalsizeoftheform(fromtoptobottom).Tochangeit:
1. DoubleclicktheHeightproperty2. Typein10003. Runprogramtoseechanges.4. Closeprogram.
7/31/2019 Integrated Assignment Booklet
33/81
32
TheLeftpropertydetermineswheretheformstartsinrelationtothelefthandcornerofthescreen.
1. Doubleclickleft.2. Typein:80003. Runprogramtonoticethechange.4. Closetheprogram5. Saveproject
LabOneScreenSaverPage13intext
Thischaptercoveredthebarebasicssofar.However,youshouldbeabletowriteaverysimpleprogram
toclearyourscreen,asshowninfigure1.7inthetextbook.
Beginwithanewproject
ProgramSpecs:
1. Thecaptionoftheformshouldbe:ScreenSaver2. Whentheprogramisrun,itshouldpresentagreendesktopcoveringtheentirescreen.
a. HINT:lookatthefunctionsofdifferentpropertiesinthepropertieswindow.3. Theusershouldnotbeabletominimizeandmaximizetheform.
Onceyouhavecompletedthisactivityshowyourteacherbeforeyoumoveontodoyourchapterreview
questions.
7/31/2019 Integrated Assignment Booklet
34/81
33
Chapter 2: All about Controls
UnderstandingControlsPage19intext(UsingPictureboxes)
Thepictureboxallowsyouputgraphicsonyourformandallowuserstointeractwiththem. Opena
newproject,MinimizeVisualBasicandfollowtheseinstructions:
1. OpenthesystemCalculator (StartProgramsAccessoriesCalculator)2. Whenitappearspress ALT+PRINTSCREEN(PressandholdAltthenpressPrintScreen)
a. Thiswilltakeapictureofthecalculatorwindow3. Closethecalculator
a. Youmightwanttowaituntilyouaresurethenextstepworkedbeforeclosing4. MaximizeVisualbasic5. DoubleclickthePictureBoxcontroltooltoplaceitontheform
a. NoticethepropertieswindowhasnowchangedtothoseofthePictureBox6. ChangetheHeightpropertyforthePictureBoxto3900,theWidthproperyto3975,top
propertyto200,andleftpropertyto200.
7. ClickthePictureBoxcontrolonyourformtomakesureithasyourattention,andpressCtrl+Vtopastetheimage.
a. Youshouldnowseeapictureofthecalculatoronyourform8. Saveyourprojectsoyoucanshowyourteacher
Page21
in
text
(Using
Command
Buttons)
TheCommandButtonisapowerfulcontrolthatmakestheprogrammingworldgoaround. Alonethey
onlytelltheuserthatsomethingwillhappenwhentheclickit.TextBoxesallowuserstoentertext,or
fortexttobedisplayed. Followtheinstructionsbelowtoseetheminaction.
1. Startanewproject2. Addatextboxtotheformbydoubleclickingthecontrolinthetoolbox. Dragthehandlesto
changethesize.
3. AddthreeCommandbuttonsbydoubleclickingthecommandbuttoncontrol.Dragthebuttonstoarrangeinarow
4. ChangetheCaptionofthefirstcommandbutton(Command1)toNothing5. ChangetheCaptionofthesecondcommandbutton(Command2)toChange6. ChangetheCaptionofthethirdcommandbutton(Command3)toExit
a. Yourformshouldnowbesimilartothatshowninfigure2.4onpage22.7. DoubleclicktheChangebuttontoopenupacodewindow. Betweentheheaderbeginning
PRIVATESUBandfooterdeclaringENDSUBiswhereyouwillspecifywhathappenswhenthis
buttonispressedbytheuser.
7/31/2019 Integrated Assignment Booklet
35/81
34
8. Betweentheheaderandfooter,type:text1.text=Changed9. ThedropdownboxatthetopofthecodewindowcurrentlyreadsCommand2,whichmeans
thattheseactionswilloccurwhencommand2ispressed.FromthatdropdownboxChoose
command3,andtype:endbetweentheheaderandfooter.
a. ThecodewindowshouldlookslikeFigure2.510.Runprogramandnoticewhathappenswhenyoupresseachbutton.11.Saveprogram
CodingControlsPage30intext (Movingshape)
1. OpenanewProjectandform2. PlaceaShapeControlontheformandapplythefollowingproperties
(Name)
Shape1
BackcolorChooseashadeofblackfromthepalette
Backstyle1Opaque
Height495
Left1500
Top120
Width 1215
3. PlaceaCommandButtonontheformandapplythefollowingproperties(Name)cmdFirst
CaptionFirst
Height
495
Left120
Top1320
Width1215
4. PlaceanotherCommandButtonontheformandapplythefollowingproperties(Name)cmdSecond
CaptionSecond
Height495
Left1560
Top1320
Width1215
5. PlaceathirdCommandButtonontheformandapplythefollowingproperties(Name)cmdThird
CaptionThird
Height495
Left3000
7/31/2019 Integrated Assignment Booklet
36/81
35
Top1320
Width1215
6. PlaceaFourthCommandButtonontheformandapplythefollowingproperties(Name)cmdExit
CaptionExit
Height
495
Left3000
Top2520
Width1215
a. YourformshouldnowresembleFigure2.7onpage317. DoubleclickcmdExit,andthecodewindowappears.Betweentheheaderandfootercommands
enterthecommand:End
8. Fromthedropdownboxonthecodewindow,choosecmdfirstandthenenterthefollowing:Shape1.Left=cmdFirst.Left
Shape1.Top=(cmdFirst.Top
Shape1.height
100)
9. FromthedropdownboxonthecodewindowchoosecmdSecond.CopyandPastethelinesfromstep8,above(Ctrl+CthenCtrl+V)andmodifyittoreadasfollows:
Shape1.left=cmdSecond.Left
Shape1.Top=(cmdSecond.TopShape1.height100)
10.FromthedropdownboxonthecodewindowchoosecmdThird.CopyandPastethelinesfromstep8,above(Ctrl+CthenCtrl+V)andmodifyittoreadasfollows:
Shape1.left=cmdThird.Left
Shape1.Top=(cmdSecond.TopShape1.height100)
a. Finishedcodeshouldresemblethatinfigure2.8onpage32.11.Runprogram.Presseachofthebuttonstoobservetheshapemoving100twipsabovethe
pressedcommandbutton.
12.ExitprogramandSaveproject
Page32intext(UsingScrollbars)
1. Openanewprojectandform,andsettheformpropertiesasfollows:Height3600
Width5610
2. Placeahorizontalscrollbarcontrolontheformandapplythesesproperties:Height255
Left0
Max1000
Top 1440
Width4575
7/31/2019 Integrated Assignment Booklet
37/81
36
3. Placeaverticalscrollbarcontrolontheformandapplytheseproperties:Height3135
Left5040
Max1000
Top0
Width
255
4. Placeacommandbuttonontheformandapplytheseproperties:(Name)cmdExit
CaptionExit
Height495
Left3000
Top2520
Width1215
5. Placeatimercontrolontheform.Placementdoesntmatterbecauseitwillnotbevisiblewhentheprogramisrunning.Settheintervalpropertyofthetimerto1.
6. Doubleclickthetimercontroltoopenacodewindowandenterthefollowinglinesofcode:Hscroll1.Value=Hscroll1.Value+1
Vscroll1.Value=Vscroll1.Value+1
7. EnterEndforthecmdExitcommandbutton8. Runprogram.
a. Noticethescrollbarsmovewithoutanyuserinteraction.Thisisbecauseofthecodewrittenintheprogram.
9. Exitprogrambeforethescrollbarsreachtheirdestination. Atthispoint,ifyouwaittoolongyouwillgetanerrorboxbecauseithasnotbeenprogrammedwithfurtherinstructions.
10.Saveproject.
LabOneBlockMover1.1page3638intext
Createaformresemblingfigure2.11onpage37inthetext. Itshouldallowtheusertomanipulatethe
positioningofashapeusingverticalandhorizontalscrollbars.
ProgramSpecs:
1. Thecaptionshouldread: Blockmover1.12. Theformshouldhavearedrectangleandtwoscrollbars,oneverticalandonehorizontal.3. Whentheusermovesascrollbar,theshapeshouldmoverelativetothepositionofthe
scrollbar.
7/31/2019 Integrated Assignment Booklet
38/81
37
BlockMover1.1Solution1. Createaformwiththefollowingspecifications
CaptionBlockMover1.1
Height
7000
Width7700
2. AddaverticalscrollbarwiththefollowingspecificationsHeight6135
Left6800
Max5500
Min600
Top120
Value600
Width255
3. AddahorizontalscrollbarwiththefollowingspecificationsHeight255
Left120
Max5500
Min360
Top6000
Value360
Width6525
4. AddashapewiththefollowingspecificationsBackcolourChooseashadeofredfromthepalette
Backstyle
1Opaque
Height495
Top600
Width1215
5. AddthefollowingcodetothecodewindowPrivateSubHScroll1_change()
Shape1.Left=Hscroll1.Value
EndSub
PrivateSubVScroll1_change()
Shape1.Top=VScroll1.Value
EndSub
LabTwoAnimatedCircles1.1Page38to40intext
7/31/2019 Integrated Assignment Booklet
39/81
38
Createaformresemblingthatinfigure2.12onpage38.Movethefourcirclesindiagonaldirections
acrosstheformastheprogramruns.Setthemovementequaltomilliseconds.
ProgramSpecs:
1. Captionoftheformshouldbe:AnimatedCircles1.12. Theformshouldhavefourcircles,eachadifferentcolour,andeachstartinginadifferentcorner3. Whenauserstartstheprogrameachcircleshouldmovediagonallyacrossthescreen.
AnimatedCirclesSolution1. Settheformdimensionstothefollowing:
CaptionAnimatedCircles1.1
Height6615
Width7635
2. Addatimercontrolandsettheintervalto13. Addashapewiththefollowingproperties:
(Name)Shape1
BackColorChooseashadeofpink
BackStyle1Opaque
Height495
Left120
Shape3circle
Top120
Width1215
4. Addasecondshapewiththefollowingproperties:(Name)Shape2
BackColorChooseashadeofpurple
BackStyle1Opaque
Height495
Left6120
Shape3circle
Top5880
Width1215
5. Addathirdshapewiththefollowingproperties:(Name)
Shape3
BackColorChooseashadeofred
BackStyle1Opaque
Height495
Left6240
Shape3circle
7/31/2019 Integrated Assignment Booklet
40/81
39
Top120
Width1215
6. Addafourthshapewiththefollowingproperties:(Name)Shape4
BackColorChooseashadeofgreen
BackStyle
1Opaque
Height495
Left120
Shape3circle
Top5880
Width1215
7. Clickthetimercontroltoopenthecodewindow.Addthefollowingcode:Shape1.Left=Shape1.Left+2
Shape2.Left=Shape2.Left2
Shape3.Left=Shape3.Left2
Shape4.Left=Shape4.Left
+2
Shape1.Top=Shape1.Top+2
Shape2.Top=Shape2.Top2
Shape3.Top=Shape3.Top+2
Shape4.Top=Shape4.Top2
8. Runprogram9. Saveproject
Experimentbychangingthevaluesinthecodeabove,aswellasthetimerinterval.
Chapter 3: Adding Menus
AddingaMenuPage4950intext
Takecarewhennamingmenuitemssothatyourmenuswillwork.Occasionallyclosethemenueditorto
checkthattherearenoerrorsbeforeyoufinishthemenu.Ifalliswell,gobacktothemenueditorand
continuefromwhereyouleftoff.
1. tartanewprojectandformandthenchoosethemenueditorfromthetoolsmenu2. Enteramenuchoicewiththefollowingspecs
CaptionFile
NameMnuFile (Watchthecaps,anddonotchangeanyothersettings)
3. ClicktheNextbutton
7/31/2019 Integrated Assignment Booklet
41/81
40
4. EnteramenuchoicewiththefollowingspecsCaptionItemOne
NameMnuOne
5. Presstherightarrowbuttontoindentit6. ClicktheNextbutton7. Enteramenuchoicewiththefollowingspecs
CaptionItemTwo
NameMnuTwo
8. ClicktheNextbutton9. Enteramenuchoicewiththefollowingspecs
CaptionItemThree
NameMnuThree
10.ClicktheNextbutton11.Enteramenuchoicewiththefollowingspecs
CaptionView
Name
MnuView
12.PresstheLeftarrowbuttontoaligntheitemchoicewithFile13.ClicktheNextbutton14.Enteramenuchoicewiththefollowingspecs
CaptionNormal
NameMnuNormal
CheckedTrue (Ensurethereisacheckinthecheckedbox)
15.PresstherightarrowbuttontoindenttheitemsoitalignswithItemOne16.ClicktheNextbutton17.Enteramenuchoicewiththefollowingspecs
CaptionSmall
NameMnuSmall
18.ClicktheNextbutton19.Enteramenuchoicewiththefollowingspecs
CaptionLarge
NameMnuLarge
20.ClicktheNextbutton21.Enteramenuchoicewiththefollowingspecs
CaptionHelp
NameMnuHelp
22.PresstheLeftarrowbuttontoaligntheitemchoicewithFile23.ClicktheNextbutton24.Enteramenuchoicewiththefollowingspecs
CaptionMain
NameMnuMain
25.PresstheRightarrowbuttontoaligntheitemchoicewithItemOne
7/31/2019 Integrated Assignment Booklet
42/81
41
26.ClicktheNextbutton27.Enteramenuchoicewiththefollowingspecs
CaptionHowToUse
NameMnuHowTo
28.PresstheRightarrowbuttontoindent29.ClicktheNextbutton30.Enteramenuchoicewiththefollowingspecs
CaptionAdvanced
NameMnuAdvanced
31.ClicktheNextbutton32.Enteramenuchoicewiththefollowingspecs
CaptionAbout
NameMnuAbout
33.PresstheLeftarrowbuttontoaligntheitemchoicewithMain34.PressOKandruntheprogramtoseehowthemenusarestructures. Exittheprogramandsave
project
CreatingPopupMenusPage51intext
1. Continueusingtheformabove.Openthemenueditor.2. Doubleclicktheformtoenterthecodewindow3. ChangetheEventMenutoMouseDown.ThismenucurrentsaysLoad. Thechoicesare
differentactionsthattheusercandototriggersomecode.
4. Enterthecodeasfollows:PopupMenuMnuHelp
5. Runtheprogramandseewhathappenswhenyourightclickontheform. Exittheprogramandsave.
CodingMenuChoicesPage53intext
1. Continueusingtheformabove.Openthemenueditor.2. HighlightViewandclicktheInsertbutton.Thiswillopenanewmenuselectionaboveview.3. Enteramenuchoicewiththefollowingspecs
CaptionExit
NameMnuExit (Againbecarefulwhennamingmenuitems)
4. PresstheRightarrowbuttonuntiltheitemisalignedwithItemThreedirectlyaboveit.5. EnsureEnabledischeckedandpressOK.6. Ontheform,SelectFile Exittoopenthecodewindow.
7/31/2019 Integrated Assignment Booklet
43/81
42
7. Enterthefollowingcode:End
8. Runtheprogramandseewhathappenswhenyouchooseexitfromthemenuyoumade.9. Saveproject
AddingMenuDividersPage54intext
AlldividersmusthavetheCaption:() Asinglehyphen EachdividermusthaveadifferentName:MnuDash1,MnuDash2,etc.1. Continueusingtheformabove.Openthemenueditor.2. HighlightExitandthenclicktheinsertbutton.Thiswillopenanewmenuoptionaboveexit3. Enterthenewmenuitemasfollows:
Caption: (justtypeinasinglehyphen)
NameMnuDash
4. ClickOK.Runtheprogramandlookatyourmenu.Saveyourproject.DynamicallyModifyingMenusPage55intext
1. Continueusingtheformabove.AddaTextboxtotheform2. OpentheMenuEditor3. HighlightExitandSettheindexto0 (zero)4. ClickOK5. Fromtheform,chooseItemTwofromtheFileMenu. Thiswillbringupthecodewindow.6. Enterthefollowingcode:
LoadMnuExit(1)
MnuExit(1).Caption=Text1.text
7. Runtheprogram. Entersomethingintotext1(SuchasEnd,War,oranything)8. FromtheFileMenu,chooseItemTwo.Lookatthechangeinthefilemenu,asreflectedinfigure
3.10onpage55.Seewhathappenswhenyouchoosethenewmenuchoice.
9. Saveyourproject.Lab
One
Using
Menus
Page57intext
CreateaformfromwhichausercanselecttohavetwosetsofMenusdisplayedunderOperationsa
simplifiedsetfortheaverageuseroranadvancedsetfortheadministrator.Theadministratorshould
7/31/2019 Integrated Assignment Booklet
44/81
43
seeeverythingthattheuserseesandmoreseparatedbydividers.SeePage57,figures3.11,3.12and
3.13forhowthemenusshouldlook.
UsingMenusSolution
Page59
in
text
1. Createaformwiththefollowingspecifications.CaptionDailyOperations
Height6000
Width7000
2. Fromthemenueditor,addanumberofmenuitems.Thenamesandstructureshouldbeasfollows.
NumberofIndentations Caption Name
None File MnuFile
One
Create
MnuCreate
One Save MnuSave
One Mode MnuMode
Two Administrator MnuAdministrator
Two User MnuUser
One (asingledash) MnuDash
One Exit MnuExit
None Operations MnuOperations
One Backups MnuBackup
One Restores MnuRestore
One CheckLogs MnuCheckLog
One
(a
single
dash)
MnuDash2
One AddUser MnuAdd
One DeleteUsers MnuDelete
One SystemShutdown MnuShutdown
None Help MnuHelp
One Blah MnuBlah
One About MnuAbout
3. Setthevisiblepropertytofalse(unchecked)foreach:MnuDash2,MnuAdd,MnuDelete,andMnuShutdown.
4.Enter
the
code
window.
For
MnuAdministrator,
enter
the
following
code:
MnuDash2.Visible=true
MnuAdd.Visible=True
MnuDelete.Visible=True
MnuShutdown.Visible=True
5. Enterthecodewindow.ForMnuUser,enterthefollowingcode:MnuDash2.Visible=False
7/31/2019 Integrated Assignment Booklet
45/81
44
MnuAdd.Visible=False
MnuDelete.Visible=False
MnuShutdown.Visible=False
Now,bydefault,theuserseesonlythatthefouritemsarenotvisible.Bychoosing
Administratorfrom
File
Mode,
the
other
items
become
visible.
By
choosing
User,
the
four
choicesareonceagaininvisible.
Chapter 4: Working with Variables
CountingSecondsPage74intext
1. Openanewprojectandform.2. Ontheform,addatextboxandacommandbutton3. Selectthetextboxandchangethefollowingproperties:
text(changetoblank)
4. Selectthecommandbuttonandchangethefollowingproperties:Caption
Exit
5. Addalabeltotheform6. Addatimertotheformandchangetheintervalto1000.
Notethetimerworksinmilliseconds,so1000ms=1sec
7. Doubleclickontheformtoopenthecodewindow.Fromthefirstdropdownboxatthetopofthecodewindowchoose(General)fromtheseconddropdownboxchooseDeclarations.Enter
7/31/2019 Integrated Assignment Booklet
46/81
45
thefollowingcode:
Constx=Numberofseconds:
Dim yasinteger
(Thiswilldeclareourvariablesandconstants)
8. ChooseCommand1fromthedropdownboxandcodeitasend.9. ChooseFormfromthedropdownboxandenterthefollowingcode:
Label1=x
Text1=y
(Noticethisdoesnotsaytext1.textthismethodisshorteranddoesthesamethingbychange
thedefaulttextpropertyofthetextbox.)
10.ChooseTimer1fromthedropdownboxandenterthefollowingcode:y=y+1
Text1=y
11.Runtheprogramandsaveproject.
NameParser(Workingwithstrings)Page8082intext
1. Openanewprojectandformwiththefollowingproperties:
CaptionNameParser
Height5250
Width6350
2. Totheformaddthefollowing:Threelabels(EnterYourname:;FirstName;LastName)
Twocommandbuttons(ParseName;Exit)
ThreeTextboxes
Arrangetheformtoresemblethefiguretotheright
3. DoubleclicktheParseNamebuttonandenterthefollowingcode:x=InStr(Text1.Text,)
Text2.Text=Left(Text1.Text,x)
Text3.Text=Right(Text1.Text,Len(Text1.Text)x)
4. CodetheExitbutton,end.5. RunProgram.6. Addanothertextboxtotheform.7. Addanotherlabelandchangethecaptionto:
MiddleName.Rearrangethelabelsand
7/31/2019 Integrated Assignment Booklet
47/81
46
textboxesonyourformtoresemblethefiguretotheright.
8. DoubleclickontheParseNamebuttontoopenthecodewindow.Changethecodeasfollows:y=Text1.Text
x=InStr(y,"")
Text2.Text=Left(y,x)
y=Right(y,
Len(y)
x)
x=InStr(y,"")
Text3.Text=Left(y,x)
Text4.Text=Right(y,Len(y) x)
9. Runtheprogramandsaveproject.
LabOnePEClassPage8486intext
Nowthatyouhaveseenhowmanythingscanbedonewithvariables,createaformthatenablesauser
toenterintoatextboxvariouschoicesfortheirphysedclasswitheachofthechoicesseparatedbya
space.Thencounthowmanycharactershavebeenenteredoneachtheline,andlistthefirstitemas
theirpreference,andallothersonathirdline.Thefigurebelowshowswhattheformshouldlooklike.
PEClassSolution1. Createanewformwiththefollowingspecifications:
CaptionPESignupSheet
Height3200
Width
7300
2. Addfour(4)textboxes,allwithaHeightof375andLeftof240. Usethefollowingadditionalspecifications:
Item WidthProperty TopProperty
Text1 7000 600
7/31/2019 Integrated Assignment Booklet
48/81
47
Text2 1200 1700
Text3 1200 2200
Text4 1200 2700
3. Addtwocommandbuttons.OnewiththecaptionComputeandtheotherwiththecaptionExit.4. Addalabeltothetopoftheform.Changethecaptionto:EnteryourchoicesforPEClassin
orderofpreference:
5. Inthecodewindow,codetheExitbutton(Command2): end6. CodetheComputebutton(command1)asfollows:
y=Text1.Text
Text2.Text=Str(Len(y))+"characterhavebeengiven"
x=InStr(y,"")
Text3.Text="Yourfirstchoiceis:"+Left(y,x)
Text4.Text="Otherchoicesare:"+Right(y,Len(y) x)
7.Run
program
and
save
project.
Chapter 5: Input and Feedback
MessageBoxExampleFormPage9497
1. CreateanewformcalledMessageBoxExample2. Addatextboxandeightcommandbuttons. Eachbuttonshouldhavethefollowingspecs:
Height495
Width1400
Hint:
You
can
copy
and
paste
the
first
button
8
times,
however
each
time
you
paste
you
will
get
amessageboxaskingyouifyouwouldliketocreateacontrolarrayPRESSNOEACHTIME.
Youcannowchangethecaptionsforeachbutton,astheyallhaveadifferentuniquename.
3. EnterthefollowingcodeforCommand1:Msg=Text1.Text
7/31/2019 Integrated Assignment Booklet
49/81
48
Title=Command1.Caption
X=MsgBox(Msg,0,Title)
4. Enterthefollowingcodeforcommand2:Msg=Text1.Text
Title=Command2.Caption
X=MsgBox(Msg,
16,
Title)
5. Enterthefollowingcodeforcommand3:Msg=Text1.Text
Title=Command3.Caption
X=MsgBox(Msg,32,Title)
6. Enterthefollowingcodeforcommand4:Msg=Text1.Text
Title=Command4.Caption
X=MsgBox(Msg,64,Title)
7. Enterthefollowingcodeforcommand5:Msg=Text1.Text
Title=Command5.Caption
X=MsgBox(Msg,3,Title)
8. Enterthefollowingcodeforcommand6:
Msg=Text1.Text
Title=Command6.Caption
X=MsgBox(Msg,259,Title)
9. Enterthefollowingcodeforcommand7:
Msg=Text1.Text
Title=Command7.Caption
X=MsgBox(Msg,515,Title)
10.Enterthefollowingcodeforcommand8:End
11.Runtheprogram.Enteravalueinthetextboxandpresseachbuttontoseethedifference. Saveyourproject.
12.Foreachofthecommandbuttons(Command1toCommand7)deletethefollowingcode:Msg=Text1.Text
13.DeleteText1fromtheform14.Doubleclicktheformtoopenthecodewindow.UnderFormLoadenterthefollowinglineof
code: Msg=InputBox(Message:,Initialization)
15.ChooseGeneralDeclararionsfromthedropdownboxesandenterthefollowingcode:DimMsgasstring
7/31/2019 Integrated Assignment Booklet
50/81
49
16.Runtheprogramandensureallthebuttonswork.Saveyourproject.Youcanskipthesectioninthebookonprintingtheformonpages9899.
LabOneMyFavouritesPage99102intext
Createaformthatcontainscommand
buttonsthattriggerInputboxesontheleft
side,andcommandbuttonsthattrigger
messageboxesontheright.Apersoncan
eitherenterstheirfavouritesinseveral
categorieswithinputboxesorseewhatthe
valuescurrentlyarebymeansofthe
messageboxes.
The
form
should
look
similartothefiguretotheright
MyFavouritesSolution1. Createanewformandusethefollowingspecifications:
CaptionMyFavourites
Height3800
Width 7200
2. Addtwolabels:Set:andView:asshownabove3. Addfourcommandbuttonsontherightandaddfourcommandbuttonsontheleft.Change
theircaptionsasshownabove.
4. EntertocodewindowandenterthefollowingcodeunderGeneralDeclarations:DimcolourAsString
DimicecreamAsString
DimbandAsString
DimauthorAsString
DimstyleAsString
DimtitleAsString
5. FromthedropdownboxchooseForm...Loadandenterthefollowingcode:colour
="Cherry
Red"
icecream="Vanilla"
band="JohnnyYellowandtheBoxcarFive"
author="StephenKing"
title="MyFavorite"
style=vbOKOnly+vbInformation
7/31/2019 Integrated Assignment Booklet
51/81
50
6. ForCommand1,enterthefollowingcode:colour=InputBox(Command1.Caption,title,colour)
7. ForCommand2,enterthefollowingcode:icecream=InputBox(Command2.Caption,title,icecream)
8. ForCommand3,enterthefollowingcode:band
=InputBox(Command3.Caption,
title,
band)
9. ForCommand4,enterthefollowingcode:author=InputBox(Command4.Caption,title,author)
10.ForCommand5,enterthefollowingcode:DimxAsString
x=MsgBox(colour,style,Command5.Caption)
11.ForCommand6,enterthefollowingcode:DimxAsString
x=MsgBox(icecream,style,Command6.Caption)
12.ForCommand7,enterthefollowingcode:Dim
xAs
String
x=MsgBox(band,style,Command7.Caption)
13.ForCommand8,enterthefollowingcode:DimxAsString
x=MsgBox(author,style,Command8.Caption)
14.Runtheprogramandtoseethatallthebuttonsandmessageboxesareworkingastheyaresupposedto.TheAuthorbuttonsshouldpopupboxeslikethoseshownbelow.
Notethatthereareafewslightdifferencesbetweentheabovecodeandwhatisinthetextbook.Pleasefollowthiscodenotthatfoundinthebook.
Chapter 6: Logic and Loops
TimerExamplePage111intext
1. Createanewform.Addatextbox(setitsalignmentpropertytoCentered)andaddatimertotheform
2. Declarexasanintegervariable(Hint: useaDimstatement)
7/31/2019 Integrated Assignment Booklet
52/81
51
3. SettheTimersIntervalpropertyto10004. SettheIntegertoincrementaslongasitis15orless,andplacethevalueofxinthetextbox.
Thefigurebelowshowstheworkingprogramandthecodewindow.
5. AlternativelychangetheIfThenstatementasshowninthefigurebelow,andyoushouldgettheresultshown.
Noticefromeachshotofthecodewindow,therearetwodifferentwaystowritethecodeforIfThenstatements.Bothmethodsworkfine.Alsoindentationsmakereadingcodeeasier.
ThePasswordProgramPage114intext
1. Createanewform.Addatextboxandacommandbutton.2. DeclareXtobeaStringVariable3. DisplayPasswordrequiredinthetextbox(Rememberthereareacouplewaystodothis)
7/31/2019 Integrated Assignment Booklet
53/81
52
4. SettheCommandbuttontocallaninputboxaskingforthepassword.IfthePasswordgivenisis1205isfunthenhavethetextboxdisplaythemessageAccessGranted.Ifthepassword
givenisanyothervalue,thenthetextboxshoulddisplayPleasetryagain
MultipleChoiceQuestionPage115116intext
1. Createanewformandsetthepropertiesbelow:CaptionMultipleChoiceQuestion
Height5700
Width7400
2. Addalabelacrossthetopandsetthefonttosize18.3. AddfouroptionbuttonsChangecaptionseachto8,9,10,114. Addtwocommandbuttons GradeandExit5. AddthelabelResult:andplaceatextboxbeneathit.6. Onceyourformlookssimilartothatshownbelow,enterthecodeasshown.
a. Yourformdoesnotneedtobeexactlyliketheonebelow.
7/31/2019 Integrated Assignment Booklet
54/81
53
DoWhileCounterPage119120
1. Createanewform.Setthecaptionpropertyto: DoWhileCounter
2. AddatextboxSetthetextpropertytoblank,andMultilinepropertytoTrue.
3. AddtwocommandbuttonsStartandExit4. Enterthecodeasshowninthefigurebelow.
5. Runtheprogram,andpressstarttoverifythatitcountsto15.6. ModifythelooptoincludeUntilthenruntheprogramuntilthevalueofxbecomes16.7. Modifytheprogramtothencountto15bythrees.
Hint: Checkyournotesonloopingstructures.
7/31/2019 Integrated Assignment Booklet
55/81
54
SystemShutdownPage123 124intext
1. Createanewform.SettheCaptionto:SystemShutdown2. Addatextboxasshownbelow.SetitstextpropertytoblankandsetMultiLinetotrue3. Addtwocommandbuttons(StartandExit)4. Codetheprogramasshownbelow.5. RunProgram.Noticehowquicklyitruns.
6. BynestinganemptyForNextloopsyoucanslowdowntheprogram.Dothisbyaddinganempty
loop
into
the
original
loop.
Thisemptylooptellsthecomputertocountto10millioneachtimeitrunsthroughtheouterForNextloop.Thisslowsdownthecountingoftheprogram. However,onmoderncomputers,
it
may
not
slow
it
down
much.
ASCIICharacterconverterPage125126intext
1. Createanewform.Addacommandbutton
7/31/2019 Integrated Assignment Booklet
56/81
55
2. Addtwolabelsandtwotextboxesasshownbelow.3. Codethecommandbuttonwiththefollowingcode:
4. Runtheprogram. Casesallowyoutobeveryspecificinwhattheconditionsneedtobeforeachchoiceofcodethatcanrun.
LaboneIncrementProgramPage128130intext
Createaformthatrequiresausertoenteranumericalvalueintoaninputboxwhentheapplicationis
started.Aftertheuserentersavalue,atextboxappearsontheform,andwithinitthenumbers
incrementinstepsofonefromonetowhatevernumbertheuserinput.
IncrementProgramSolution1. Createaformandusethefollowingspecs:
CaptionIncrement
Height6500
Width4600
2. Addatextboxtotheformandsetthefollowingproperties:Alignment2center
Height6000
Left0
MultiLineTrue
Scrollbars2(Vertical)
Top240
width1215
3. Addanexitbutton
7/31/2019 Integrated Assignment Booklet
57/81
56
4. Gotothecodewindow,andunderGeneralDeclarationsenterthefollowingcode:Dimxasinteger
DimyasInteger
5. UnderForm_loadenterthefollowingcode:
6. Codetheexitbutton(Command1):End7. Runtheprogram.
LabTwoDayofYearPage130
133in
text
Createaformthatacceptsanumerical representation
ofadateintwotextfieldsMonthandDay.The numericalday
oftheyearrepresentedbythedateisthencomputedbytheprogram.Forexample,January15isthe
15thdayoftheyearandMarch14thisthe73rddayoftheyear.
DayofYearSolution1. Createanewformwiththefollowingspecifications:
CaptionDayofYear
Height
3650
Width4800
2. Addtwolabelsandtwotextboxes.Label1CaptionEntermonth(112)
Label2CaptionEnterday(131)
3. Addtwocommandbuttons:ComputeandExitasshowninthefigureabove
7/31/2019 Integrated Assignment Booklet
58/81
57
4. Addathirdlabelbelowthetwobuttonsandsetcaptiontoblank5. InthecodewindowenterthefollowingcodeunderGeneraldeclarations:
Dimxasinteger
Dimyasinteger
6. Codetheexitbutton(Command2): End7. Forthecomputebutton(Command1),enterthefollowingcode:
8. Runprogram.Saveproject.Chapter 7: Arrays, Dates, and Randomization
ArrayofMonthsPage143144
1. Createanewform.Addatextboxandlabela. Setbothtoa14pointfont. FortheTextboxsetLockedtoTrue(Thiswillpreventthe
userfromtypinginthebox)
7/31/2019 Integrated Assignment Booklet
59/81
58
2. Addthreecommandbuttons:Next,PreviousandExit3. Inthecodewindowdeclarexasanarrayand yasaninteger
Dimx(11)asstring (stores12monthsfrom0[Jan] to11[Dec])
Dimyasinteger
4. UnderForm_Loadenterthefollowingcode:
5. Codethenextbutton(Command1)withthefollowingcode:
6. CodethePreviousbutton(Command2)withthefollowingcode:
7. CodetheExitbutton(Command3)with: End8. Runtheprogramandsaveproject.
CommandButtonArrayPage145146intext
1. Createanewform.Addasinglecommandbuttonandkeepthedefault
name
(Command1)
2. RightclickthecommandbuttonandchooseCopy3. RightclicktheformandchoosePaste.Amessageboxappears
informingyouthatyoualreadyhaveacommand1andasks
whetheryouwishtocreateanarray.ClickYes.
7/31/2019 Integrated Assignment Booklet
60/81
59
4. Pastethecommandbuttonsixmoretimes,sothatyouhaveeight(8)buttonsontheform.Arrangetheminacolumn.NoticethatthenameisnowCommand1(0)uptoCommand1(7)
5. Doubleclickthefirstcommandbuttontogetthecodewindow,thenenterthefollowing: End6. DoubleclicktheformtoenterthecodewindowandenterthefollowingcodeunderForm_load:
7. Runtheprogram.Noticeall8buttonsdothesamethingexittheprogram
CardShark1.1Page146148intext
1. Createanewformandtitleit:CardShark1.1
2. Addatextbox.SettheLockedpropertytotrueandTexttoblank.
3. AddThreetextbuttons:NextCard,PreviousCard,Exit
4. UnderGeneralDeclarations,declarethefollowing:Dim
x(51,
1)
As
String
DimaAsInteger
7/31/2019 Integrated Assignment Booklet
61/81
60
5. UnderFormLoadenterthefollowingcode:
6. ProgramtheNextcardbuttonasfollows:
7/31/2019 Integrated Assignment Booklet
62/81
61
7. CodethePreviouscardbuttonasfollows:
8. CodetheExitbutton:End9. Runtheprogram.Saveproject.10.MakethefollowingchangetothecodeunderFormLoad
DELETETHELINE: a=0
Replaceitwiththehighlightedlinesbelow
11.Runprogramandsaveproject.Thecardsshouldnowbecompletelyrandomized.DestinationsUnlimitedPage150151intext
1. Createanewformandcaptionit:DestinationsUnlimited2. AddaListBoxtotheform,alabelandtwocommandbuttons.
a. LabelCaptionPickadestinationCommand1caption(blank)
Command2CaptionExit
3. Inthecodewindow,codebothcommandbuttons:End
4. UnderForm_Loadenterthefollowingcode:
7/31/2019 Integrated Assignment Booklet
63/81
62
5. ChooseList1andclickfromthedropdownboxesatthetopofthecodewindow. Enterthefollowingcode:
6. Runprogramandsaveproject.VideoWorldPage151152
1. Createanewformandgiveitthecaption:VideoWorld2. AddTwoListBoxes,TwoLabelsandTwocommandbuttonswiththecaptionsasshowninthe
figurebelow.
3. Codethesubmitorderbutton:MsgBox("Yourorderissubmitted")
End
4. UnderFormLoad,enterthefollowingcode:
5. ModifytheList1propertiesasfollows:SortedTrue
MultiSelect1Simple
6. CodetheMovebuttonasfollows:
7/31/2019 Integrated Assignment Booklet
64/81
63
7. Runtheprogram.SaveProject.Togivetheprogramamorepolishedappearance,makethefollowingchanges.
8. Addatextboxandalabeltotheform,asshowninthefigure.9. AddtwomorecommandbuttonsandcaptionthemClearanEntryandClearAllEntries10.AddtheunderlinedcodetotheMovebuttoncode.
11.CodetheClearanEntrybuttonasfollows:
12.CodetheClearallEntriesbuttonasfollows:
13.Runtheprogramandsaveyourproject.
7/31/2019 Integrated Assignment Booklet
65/81
64
LabOneMagic8Page160162intext
CreateMagic8formwithatextboxandonlytwocommandbuttonsAnswerandExit.Justlikethe
noveltytoy,
Magic
8Ball,
aperson
can
ask
aquestion
to
the
program,
and
then
press
the
answer
button
andseewhethertheirwishwillbegranted.
ThePossiblevaluesfortheMagic8answersthatappearinthetextboxshouldbeoneofthefollowing.
Yes No Maybe Definitely Sorry TryAgain
Magic8Solution1. Createanewformandcaptionit:Magic82. Addatextboxandtwocommandbuttons(ExitandAnswer).CodetheExitButtonas:End3. EnterthefollowingunderFormLoad:
Randomize
4. CodetheAnswerButtonasfollows:
5. Runtheprogram.Saveproject. TheRandomizefunctioniscalledtohelpensurethatRndproducesanewvalueeachtimeitiscalled.
7/31/2019 Integrated Assignment Booklet
66/81
65
LabTwoConneRiverLottoPage162163intext
CreateaLotteryprogramthatpulls6numbersoutofapoolofnumbersavailabletoalotteryandthen
presentsthem
in
atext
box.
This
example
is
trickier
than
the
last
example
for
one
simple
reason
after
anumberispresented,itcannotbepresentedagain.Forinstance,youcannothavetheresult: 110
131410.1and10cannotbepulledtwicebecauseonceitispulleditisnolongeravailable. This
issimilartotheLotto6/49,theprogramshoulddraw6numbersfromapoolof49numbers.
ConneRiverLottoSolution1. Createanewformandchangethecaption
to:ConneRiverLotto
2. Addatextboxandtwocommandbuttons(Spin
and
Exit).
Code
the
Exit
button
to
:
End
3. UnderGeneraldeclarationsenterthefollowingcode:
Dimlotto(1to6)asInteger
Thiswillstoreeachofthe6numberssothattheycannotbechosentwice.
4. CodetheSpinbuttonasfollows:
7/31/2019 Integrated Assignment Booklet
67/81
66
Chapter 8: Working with Procedures
PersonalityComputerPage180181intext
1. Createanewform.Addtwocommandbuttons,twotextboxesandalabelas
showninthefigure.
2. SelectthelargetextboxandsettheLockedpropertytoTRUE.
3. CaptionthesecondcommandbuttonExitandcodeitasfollows:
End
4. CaptionthefirstcommandbuttonComputePersonalityandcodeitasfollows:Compute
Val(Text1)
5. FromtheTOOLSmenuselectADDPROCEDUREIntheNamespacecallitCompute andensurethatPublicandSubarebothselectedfromtheoptionsbelow.PressOK.
6. CodetheComputeprocedureasfollows:
7. Runprogram.SaveProject Theprogramtakesthenumberthattheuserentersintothesmalltextboxandfeedsitintotheprocedurewhichselectsthecorrespondingphrasetodisplayinthelargetextbox.
7/31/2019 Integrated Assignment Booklet
68/81
67
ReversalofFortunePage183 184intext
1. Createanewform.Addtwocommand
buttons,
two
text
boxes,
andtwolabels,asshowninthe
figure.Clearallthetextfromthe
textboxes.Setthelockedproperty
ofText2(thebottomtextbox)to
TRUE.
2. OpenthecodewindowandcodetheExitButtonas:End
3. CodetheReverseButtonasfollows:CallReverse
Text2=Reverse
4. SelectAddProcedurefromthetoolsmenuandaddaFunctioncalledReverse,asshowninthe
figuretotheright.
5. Oncebacktothecodewindow,codetheReversefunctionasfollows:
6. Runprogram.SaveProject.Whateveristypedintotext1shouldbedisplayedintext2backwards.
AddingSplashScreensPage185186intext
1. OpentheCardSharkProgramthatyoucreatedinthelastchapter.(Ifyoufailedtosavethisproject,
open
one
of
your
other
programs).
2. ClickontheNewFormbutton(orPROJECTMENU ADDFORM).SelectSplashScreenfromthelistofformtypes.
7/31/2019 Integrated Assignment Booklet
69/81
68
3. ModifythecaptionfieldsontheSplashformtolooklikethoseshowninthefigurebelow.
4. ChangethecodeontheExitbuttonto: (DeleteEnd)Form1.Hide
FrmSplash.Show
5. AddatimertotheFrmSplash.SettheIntervalpropertyto1000.Doubleclickthetimerandaddthefollowingcode:
Secs=Secs+1
IfSecs>3thenEnd
6. ThedeclarationssectionofthefrmSplashalreadyincludesOptionExplicit,beneathitadd:DimSecsasInteger
7. FromthefrmSplashcode,deletethefollowingcode:
Thiswillensureyoursplashscreenappearsasyouwantitto.
8. Runprogram.ExitProgram. TheSplashscreenshouldappearfor3secondsthenclosetheprogram.
LabOneAnnoyingSplashScreensPage187intext
Createaprogramthatcontainsthreeforms.ThefirstisaSplashFormthatwelcomestheusertothe
program.TheSecondwillbeoneofyourotherprograms(ie.TheFortuneReversalprogram).TheThird
willbe
an
annoying
screen
that
explains
to
the
user
that
they
just
used
aShareware
version
of
the
programandcangetafullversionoftheproduct,whichhasmanymorefeatures,foronly$15(Cash
only,nochequesormoneyorders).
Sorry,nosolutionforthisone.Tryitonyourown.
7/31/2019 Integrated Assignment Booklet
70/81
69
Chapter 9: MDI Forms, Modules, and Miscellany
WorkingwithMDIChildrenPage
194
196
in
text
1. Startanewprogram2. ClicktheProjectMenuandchooseAddMDI
Form.Adialogueboxappears,ChooseMDIform
andclickopen.
3. AnewformappearswiththecaptionMDIForm1.IfyounowtrytoaddanotherMDIform,youfind
thatthemenuchoiceisdisabled;onlyoneMDI
formcanbeusedperprogram.
4. TomaketheMDIformthedefaultformthatappearswhenyoustarttheprogram,choose
ProjectpropertiesfromtheProjectmenu.On
theGeneraltabchangethestartupobjecttothe
MDIForm1,asshowninthefiguretotheright.
5. UndertheMDIForm1propertieschangetheWindowStateto2(Maximized)
6. AddanExitbuttontotheStandardform(Form1)andcodeit:End
7. UndertheForm1propertieschangetheMDIChildproperty
to
True.
8. GototheMDIFormandstartthemenueditor.AddamenuchoiceChildrenwithoneitembeneathit
Openachild,enteringboththenameandc