Information Systmes HW

profileDre_fingerz
img_20161115_0002.pdf

9. \X/hich of the following will display $8.00, $8.50, $9.00, and $9.50 in message boxes- a. For decDollars As Dec'i mal = 8 To 9.5 Step 0.05

MessageBox. Show(decDol I ars . ToSt ri ng ("C2 ") ) Next decDollars

b. For dblDollars As Double = 8 To 9.5 Step 0.5 lt4essageBox . Show(dbl Do'l

'l ars . ToSt ri nS ( "C2 " ) )

Next dblDollars

c. For strDolIars As String = "$8.00" To "$9.50" Step "0.5" lvlessageBox. Show(strDol I ars)

Next strDol I ars

d. both b and c

10. A For...Next statement contains the following For clause: For intxAs Integer =: To -1 Step -2. \X/'hat value will cause the For...Next loop to stop?

a. -1 b. -2

c. -3 d. none of the above

TRY THIS

TRY THIS

Exercises 1. List the processing steps for the following code. Use Figure 14-3 as a guide. (See

Appendix B for the answer.)

For decX As Dec'i mal = 6.5 To 8.5 I4essageBox. Show(decX. ToSt ri ng ("N1") )

Next decX

2. Open the OddEven Solution (OddEven Solution.sln) file contained in the ClearlyVB2012\Chap14\OddEven Solution folder. The interface provides text boxe. for the user to enter two integers. The application should display all of the odd numbers from the flrst integer through the second integer; it shouid also display all of the even numbers in that range. (See Appendix B for the answer.)

a. Code the application using the For...Next statement. If the integer in the txtNu.' control is greater than the integer in the txtNum2 control, the stepValue should , negative number 1; otherwise, it should be a positive number 1.

b. Save the solution and then start the application. Test the application using the integers 6 and25. The applicatlon should display the following odd numbers: - 11, 13, 15, 17, 19,21, 23, and 25. It also should display the following even nu 6, 8, 10, 72, 14, 16, 18, 20, 22, and 24.

c. Now test the application using the integers 25 and 6. The application should the following odd numbers:25,23,21,,79, 17, 15, 73,11, 9, and 7. lt also shou.- display the following even numbers 24,22,20, 1,8, 16, 14, 72, 10,8, and 5. C1os. Code Editor window and then close the solution.

Open the Cheerleader Solution (Cheerleader Solution.sln) file contained in the ClearlyVB2012\Chap14\Cheerleader Solution folder. Change the Do...Loop stat in the btnclickHere_Click procedure to a For...Next statement. Save the solution and then start hnd test the application. Close the Code Editor window and then the solution.

MODIFY THIS

[r1,re