Worksheet_4 (SLO) – 20 points

Due Date: Tuesday, May 08, 2018 on or before 11:30 p.m. (local time)

This document contains six (6) pages. Our fourth graded worksheet is stated as follows;????????????????????????????

Students will create Visual Basic programs that will incorporate Additional Controls and Objects. This SLO will cover chapter 9 of our textbook. This worksheet contains 5 Review Questions, each worth 4.0 points, for a total of 20 points. This worksheet must be completed independently by each online student.

 

Each review question is located on a page on its own. After careful reading of the text of each Review Question, place your completed response on the space provided under “Your Response”. Please also note that some of the review questions may contain multiple parts. Please provide your response for each part in the space provided.

Please note: Careful consideration has been given to avoid any typing error, therefore, please “assume no errors on my part”. For instance, as you may encounter in the textbook the author has abbreviated the lengthy text within the parenthesis of the header of event procedure, as follows;

????????????????? “Private Sub objectName_event(…) Handles objectName.event

Please do not assume that the above code contains errors, however, if you encounter errors that would significantly alter your response, except the typing errors, such an extra hyphenation mark, or missing open or close parentheses or brackets, then please contact me immediately via email, so that it be corrected.

Please further note: that all your responses (work) must be clearly shown on this Word document! After completing your worksheet, please upload your completed Word document, to the Canvas, not later than Tuesday, May 8th, 2018 on or before 11:30 p.m. (local time), using the format “Worksheet_SLO_4_Your Full-name” as the filename of your Word document. Please do not try to compress the Word document when you upload your completed work to Blackboard.

Please be advised: Effective consistency with fundamental and basic programming materials covered in this course must be observed. It is strongly recommended that your response to each review question or part hereof, would be consistent to basic programming topics that are covered in the textbook, or supplementary reading materials that are uploaded to the “Content” area link of Canvas. ?Please refrain from including materials that may be found on the Internet or in other sources.

Failure to comply may results in obtaining a grade of “F” on this worksheet

?

 

Please enter the following information below:

Last Name: ___________________

First Name:___________________

Student ID: ___________________

?

 

Reviewing Question_1:

Assume the content of the combo box cboBox appears as shown below;

?????????????????????????????????????? ???????

Furthermore, assume that the cboBox has its DropDownStyle set to Simple and has its Sorted property set to True.

Required: Write a block (two or three lines) of code determining if Cervantes is in the list. Furthermore, your code must include statement(s) to verify that Cervantes is found. Also, suppose Cervantes is not found, then your code must include the necessary statement(s). (Please note that your lines of code should do the job, even if additional items haven been added to the list.)

Your Response:

?

?

?

?

?

?

?

?

?

?

?

?

?

?

.

Reviewing Question_2:

Suppose the array rivers contains the names of rivers. ?

Required: Write Visual Basic line(s) of code that randomly select two different rivers from the array and display them in the lstBox.?

Required: If the array contains fewer than two names of rivers, display a messageThe array has fewer than two elements

Please further note: ?Important: You do not need to declare any array implicitly and initialize it with the names of finite number of rivers. Just assume that the array rivers contain names of rivers.

Your Response:

?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.

Reviewing Question_3:

Suppose the following programDemonstrate Menususes menus with two top-level menu items, as shown below;

????????????????????????????? ?????????????????????????

?In above the top-level menu item, Order is shown with two second level menu items, Ascending and Descending.

Required:

  • Briefly explain how you set up an access key for a second-level menu item
  • Briefly explain how you set up a shortcut key for a second-level menu item
  • Suppose you now run the program, briefly explain, how you would activate a second-level menu item, using its access key.
  • Suppose you now run the program, briefly explain, how you would activate a second-level menu item, using shortcut key.

Your Response:

 

 

 

 

(d)

 

?

?

 

 

.

Reviewing Question_4:

?Assume multiple forms are present:

Required: After reading the following block of code, in some details explain the effect of the yellow highlighted statements (what they perform!)

Required: ?Determine the output displayed in the text box when the button is clicked: (Assume the responses are 80, 100, and -1.)

‘Form1’s code??? ??(startup form)?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Public average As Double

Private Sub Form1_Load(…) Handles MyBase.Load

Form2.ShowDialog()

End Sub

 

Private Sub btnComputeAverage_Click(…) Handles btnComputeAverage.Click

? Dim num As Double

? Dim count As Integer = 0

? Dim sum As Double = 0

? num = CDbl(InputBox(“Enter a nonnegative number”))

? Do While num <> ?1

??? count += 1

??? sum += num

??? num = CDbl(InputBox(“Enter a number”))

? Loop

? average = sum / count

???????? Form3.ShowDialog()

? Me.Close()

End Sub

 

‘Form2’s code

Private Sub Form2_Load(…) Handles MyBase.Load

? Dim message As String = “The purpose of this program is to” &

????? ” calculate the average of a set of nonnegative numbers” &

????? ” input by the user. Enter the numbers one at a time” &

????? ” and enter ?1 to signal the end of data entry.”

? MessageBox.Show(message, “Instructions”)

? Me.Close()

End Sub

 

‘Form3’s code

Private Sub Form3_Load(…) Handles MyBase.Load

? txtAverage.Text = “The average is ” & Form1.average & “.”

End Sub

 

Your Response:

.

Reviewing Question_5:?

?

Required: Carefully examine the following code segment and describes in some details what the following code segment performs Be explicit!!

Private Sub btnDraw_Click (……) Handles btnDraw.Click???????????????????????????????????????????????????????????????????????????????????????????????????????? Dim gr As Graphics? =? picBox.CreateGraphics????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????gr.DrawLine (Pens.Red,5,100,100,5)????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????gr.DrawLine (Pens.Red,100,5,195,100)???????????????????????????????????????????????????????????????????????????????????????????????????????? gr.DrawLine (Pens.Red,5,100,195,100)? ???????

End Sub

 

Required: Next, demonstrate by drawing the shape the above code produces, and then clearly state what geometric shape the code has produced.

 

Your Response:

(a)

?

?

?

(b)