SLO Assignment SLO3 Word Document. This word file contains Six (6) pages. Due: Sunday, November 21, 2021 at 11:30 pm, local time. Please enter the following information below: Last Name: ___________________ First Name: ___________________ Student ID: ___________________

Instructions for completing the SLO Assignment

There are five (5) review questions, each worth 3.0 points, covering chapters, 7, and 8 in the textbook and worth a total of 15-point value.

Preparation Plan: Before attempting to response to any review question, thoroughly read the text of each review question, and or part thereof, and locate the key concept. Review the section in the chapter of your textbook, closely associated with the review question. When ready to provide your completed response, place it on the space provided under “Your Response”.

Please note: If you are using Mac computer to complete this SLO Assignment on Apple Pages, you are required to convert it to Microsoft Word before submitting your assignment.

Please note: Careful consideration has been given to avoid any typing error. For instance, in (Chapter 2, Section 2.3 of the text), the author has abbreviated the lengthy text within the parenthesis of the header of event procedure. (Do not assume this is an error on instructor part)

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

Please note: All work must be shown on this Word document. Use the naming rule: “SLO3_Your Full Name” as the filename of your Word document. (DO NOT CREATE ANY FOLDER), for submitting your SLO assignment.

Submitting your Assignment to CANVAS: locate SLO3 entry under the SLO ASSIGNMENTS text heading, where you first downloaded this word document. Next, upload “SLO3_Your Full Name “Word document, and click on Submit Assignment button.

Feedback/ grade to your responses is based on:

  1. Effective consistency of your work MUST adhere to the topics covered in above chapters. Please refrain from including materials that may be found on the Internet or by other sources. Failure to comply may results in obtaining a grade of “F” on this assignment.
  2. Your work MUST be done independently on this Word document.
  3. For all your responses, correct use of sentence structure must be used, and be free of any grammatical and typing errors.

SLO3 Objectives: Students will create Visual Basic Programs that will incorporate Arrays and Text File handling.

Review Question_1: (3.0 Points) consists of two parts

  1. Required: (1.5 points): Determine the output displayed when the button is clicked. “Assume no errors on the instructor part”.

Private Sub btnDisplay_Click(……) Handles btnDisplay.Click

Dim speech() As String = {“four”, “scores”, “and”, “seven”, “years”, “ago”}

speech = UpperCase(speech)

txtOutput.Text = speech(6)

End Sub

Function UpperCase(words() As String) As String()

Dim n As Integer = words.Count – 1

Dim temp(n) As String

For i As Integer = 0 To n

temp(i) = words(i).ToUpper

Next

Return temp

End Function

  1. Suppose the array pres has been filled with the names of the 45 U.S. presidents in the order in which they served.

Required: (1.5 points): Write ONLY a One Line of Code to determine the number for “James Monroe”, using the txtOutput text box.

Your Response: Write your response under each letter:

Review Question_2: (3.0 Points) consists of two parts

  1. Assume the five lines of the file Dates.txt contain the numbers 1492, 1776, 1812, 1929, and 1941 and the file is in the program’s bin/Debug folder.

Required: (1.5 points): Determine the output displayed when the button is clicked. “Assume no errors on the instructor part”.

Private Sub btnDisplay_Click(……) Handles btnDisplay.Click

Dim dates() As String = IO.File.ReadAllLines(“Dates.txt”)

Dim query = From yr In Dates

Where (CInt(yr) >= 1900)

Select yr

txtOutput.Text = query.Count & ” twentieth century dates”

End Sub

  1. Required: (1.5 points): Determine the output displayed when the button is clicked. “Assume no errors on the instructor part”.

Private Sub btnDisplay_Click(……) Handles btnDisplay.Click

Dim words() As String = {“When”, “in”, “the”, “course”, “of”, “human”, “events”}

Dim query = From word In words

Order By word.Length

Select word.Length

Dim greatestLength As Integer = query.Last

Dim query2 = From word In words

Where word.Length = greatestLength

Order By word Descending

Select word

lstOutput.DataSource = query2.ToList

lstOutput.SelectedItem = Nothing

End Sub

Your Response: Write your response under each letter:

Review Question_3: (3.0 Points)

Carefully study the following lines of code, containing two structures, Structure Appearance, and Structure Person.

Required: (3.0 points): Fill in the missing lines of code, as instructed in steps (a) through (f), below:

  1. Give person1 the name of Michael. (d) Give person2 the name of Jacob.
  2. Set Michael’s height to 71 inches (e) Set Jacob’s height to 70 inches
  3. Set Michael’s weight 190 pounds. (f) Set Jacob’s height to 175 pounds.

If one person is both taller and heavier than the other person, then write the necessary code to display a sentence of the form: “[name of a bigger person] is bigger than [name of smaller person].”

(Remember: You will only need to write the “Missing Lines of codes”) “assume no errors on the instructor part”.

Structure Appearance

Dim height As Double ‘inches

Dim weight As Double ‘pounds

End Structure

Structure Person

Dim name As String

Dim stats As Appearance

End Structure

Private Sub btnDisplay_Click(……) Handles btnDisplay.Click

Dim person1, person2 As Person

(missing lines of code)

End Sub

Your Response: Write response next to each letter. Then write the “(missing lines of code) “

  1. ..… (d)…..
  2. ..… (e)…..
  3. ….. (f)….

Review Question_4: (3.0 Points) consists of two parts

  1. Required: (1.5 points): Carefully study following lines of code, identify, and explain possible error(s) in the code. If there are no error(s) identified, state (NONE). (Note: Do not rewrite any corrected code.) “Assume no errors on the instructor part”.

Private Sub btnDisplay_Click(…) Handles btnDisplay.Click

Dim sw As IO.StreamWriter

Try

sw = IO.File.CreateFile(“E:\Lakes.txt”)

Catch IO.IOException

MessageBox.Show(“Is there a CD in the E: drive?”)

End Try

sw.Close()

End Sub

  1. Required: (1.5 points): Assume the file NYTimes.txt contains the names of all subscribers to the New York Times and the file WSJ.txt contains the names of all the subscribers to the Wall Street Journal.

Carefully study following lines of code, and describe the new file created by the code. “assume no errors on the instructor part”.

Dim times() As String = IO.File.ReadAlllines(“NYTimes.txt”) Dim wsj() As String = IO.File.ReadAlllines(“WSJ.txt”) Dim unionArray() As String = times.Union(wsj).ToArray Dim IntersectArray() As String = times.Intersect(wsj).ToArray IO.File.WriteAlllines(“NewFile.txt”, unionArray.Except(intersectArray))

Your Response: Write your response under each letter:

Review Question_5: (3.0 Points) consists of two parts

  1. Suppose you wish to open a file named DiskInfo.txt for input, however, you don’t know whether the file exists.

Required: (1.5 points): Write the lines of code necessary to open the file: (Remember: Use the file name asDiskInfo.txt “)

  1. Assuming an application uses a Listbox named lstInventory. Required: (1.5 points): Provide the necessary lines of code to writes the contents of the listbox to the file named Inventory.txt: (Remember: Use listbox named lstInventory, and file name Inventory.txt )

Your Response: Write your response under each letter:

Subscribe For Latest Updates
Let us notify you each time there is a new assignment, book recommendation, assignment resource, or free essay and updates