Information Systmes HW

profileDre_fingerz
ch_15.pdf

I'm on the lnside; You're on the Outside (Nested Loops)

i ,epert for vwLwt'tLes fron'. o tkrovt2)rt sJ: YePeai f or secowds frow" o tlnrowqk sJ:

nested loop I . T ove secowd' )nawd t posLtLow' cLcctsvtLse : ewd rePeat i wto,Je rwLwttte hawd t pcsLtLow, cLocQwLse

iF o'" A ,.aronl1,,.,..,_,*"'_, ,..,...-,.", - --* fi6irr* i*-* Logic used by a clock's minute and second hands O Cengage Learning 2013

Eigure 15-4 shows the interface for the Clock application. (The ciock image was downloaded

frJm the Open Clip Art Library at http://openclipart.org,) ln the Start button's Click event procedure, you *ili have an outer loop display the number of minutes, and a nested loop dlsplar ihe numbe. of seconds. For simplicity in watching the minutes and seconds tick away, you wiLl

display minute values from 0 through 2, and display second values from 0 through 5'

.flockE_+

Pvlinutes:

B

Seronds: fl

Ev!tStart

Iig:;ri* li-4 Clock application's user interface 0penClipArt.orgliltre

.i ,t :{': ' +li .?{',i

'*., Start Visual Studio 2012. Open the Clock Solution (Clock Solution.sln) file containec in the ClearlyVB20l2\Chap15\Clock Solution folder. If necessary, open the designer window.

;-:. Open the Code Editor window and locate the btnStart-Click procedure. Enter the oute: and nested ioops shown in Figure 15-5. The Refresh and Sleep methods are required s,-

that you can view each of the minute and second values in the interface.