Monday, October 25, 2010

lecture notes

Format of the test
_____________________

10 short answers (30 points)
6 m/choice questions (30 points)
4 Debugging (20 points)
4 Programming questions (20 points)
1 Tracing question (10 points)

Dim pos as Long
pos = TextBox1.Text

if pos = 1 Then
  txtOutcome.Text = "Win"
elseif pos = 2 Then
  txtOutcome.Text = "Place"
elseif pos = 3 Then
  txtOutcome.Text = "Show"
elseif pos = 4 or pos = 5 Then
  txtOutcome.Text = "You almost placed in the money."
else
  txtOutcome.Text = "Out of the money."
endif

syntactic sugar
 Select Case


if position >= 1 Or position <= 3 Then
instead, in a Select Case, we could say
Case 1 To 3

Assignment 9
HW: "Select Case"
10-36, even

Public Class Form1
    Sub Moo()
        MessageBox.Show("Mooooooooo!")
        MessageBox.Show("Baaaaaaaaa!")
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Moo()
        Moo()

    End Sub
End Class

2 comments:

  1. what will debugging and tracing questions contain?

    ReplyDelete
  2. debugging questions are similar to the spot the error questions in the exercises.

    tracing questions involve filling in a grid to show the value of variables at each point in the program.

    ReplyDelete