Friday, March 26, 2010

my email address

is joshwaxman at gmail dot com.

contact me if you need to know your grade

Thursday, March 25, 2010

Scores, and the curve

The curve is square root of the grade times 10. Here is a chart of grades:


total      m/c, of 15         part 2   part 3
27        5                      1          6
30        6                      0          6
34        5                      2          12
38        7                      0          10
41        7                      0          13
42        7                      0          14
42        6                      0          18
43        6                      7          12
44        8                      0          12
47        7                      1          18
47        9                      3          8
48        8                      0          16
49        7                      5          16
50        8                      1          17
52        6                      12        16
53        7                      7          18
54        9                      6          12
57        8                      7          18
58        7                      11        19
58        9                      3          19
59        10                    4          15
60        9                      8          16
61        10                    1          20
63        9                      11        16
63        8                      11        20
66        9                      20        10
66        11                    5          17
67        10                    10        17
67        11                    5          18
68        12                    10        10
70        10                    13        17
71        12                    7          16
72        8                      20        20
73        9                      17        20
77        10                    18        19
79        10                    19        20
82        11                    20        18
88        12                    20        20
92        13                    20        20

Summary statistics, pre-curve:
MAX 92
MIN 27
AVG 57.9
MEDIAN 58
MODE 42

Wednesday, March 24, 2010


some clarification of some answers, for the first sample test:
(6) The position of the lowercase letter L is as the third position in the string. But counting begins at 0, so it is 2.

(9) This is what Trim does. As discussed in the book, It takes a string, and strips out any leading and trailing spaces.

(10) The person who wrote this question made an error. Here is a trace. In the first line, x is 0. After the second line, x is 4. In the third line, x+=2 is the same as x=x+2, which is x=4+2, so x is 6. In the fourth line, while we modify x by something, we don't assign anything to it with the = operator, so x itself remains unchanged. Thus, x is still 6, not 18.

(12) The explanation for this one is the same as for question 6. The position of lowercase letter T is as the sixth position. But since counting begins at 0, that would be position 5.

(14) I suppose that (A) is really what was intended, and this is also acceptable. And this was likely what was intended. But one could also say (D), since the number would still remain as the Double data type.

Tuesday, March 23, 2010

Answers to the second sample exam:
m/ch
1) b
2) d
3) c
4) c, because of the clear
5) the person who wroye the question was looking for a
6) c
7) a
8) a
9) d
10) d. the two labels, the two textboxes, and the form.

pt 2

Private Sub Button1_Click() Handles Button1.Click
   Dim name as String
   name = InputBox("what is your name", "get name")
   If name > "carl" Then
      MessageBox.Show("your name comes after carl")
   ElseIf name < "carl" Then
      MessageBox.Show("your name comes before carl")
   Else
      MessageBox.Show("your name is carl!")
   EndIf
End Sub

pt 3 -- functions not on test
Answers to the first sample exam:
m/ch
1) B (but D also OK)
2) C
3) C
4) A
5) A
6) C
7) Not covered
8) Not covered
9) B
10) None of the above. The answer is 6
11) D
12) A
13) E
14) D
15) D

 part ii -- not covered

part iii --
1)
copy and paste this to Word -- not all columns are showing. You cannot see y and z.
Private Sub btnEval_Click(…) Handles btnEval.Click
x
y
z
     Dim x, y, z As Integer
0
0
0
     x = 4
4


     y = 2 + x + x

10

     z = y * x


40
     lstResult.Items.Clear()



     lstResult.Items.Add(z – y)



     lstResult.Items.Add(x + 2)



End Sub





2)
Hello

Wednesday, March 17, 2010

note to self

make up 3 m/ch questions on ifs

make up 3 programming problems on ifs

Monday, March 15, 2010

code from class

scheduled midterm 1,

this coming wednesday.
look at these exams:
Here and here

Wednesday, March 10, 2010

notes

Branching
Conditional Branching
Decision making

Comparison Operators
=
>
<
>=
<=
<>

Logical Operators
And
Or

we will resume with or operator

hw:
8 thru 30, even
8. is: (5 - a) * b < 7

Monday, March 8, 2010

read from a file
write it out to a textbox

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim sw As IO.StreamWriter
        sw = IO.File.AppendText("c:\josh\josh3.txt")
        sw.WriteLine("hello there")

        sw.Close()
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sr As IO.StreamReader
        sr = IO.File.OpenText("c:\josh\josh2.txt")
        TextBox1.Text = sr.ReadLine()
        Button1.Text = sr.ReadLine

        sr.Close()

    End Sub

3.5
60-66 even
'Each line triplet of DATA.TXT contains         DATA.TXT

70-76, even
The following steps calculate the amount of money earned in a walk-a-thon:

Wednesday, March 3, 2010

notes from class

input:
    textbox
    files
    s = inputbox("prompt")

output:
    debug.print
    listbox
    textbox
    file


format
formatcurrency
formatpercent
string.format
format string prior to outputting it

hw: 3.5: 32 - 36, even numbers

memory

some more code

Public Class Form1
    Dim x As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim x, y As Single
        x = 3.1
        y = 8
        ' Debug.Print(FormatNumber(x, 2))
        Debug.Print(String.Format("Your number, {0}, is {1}. Thanks for playing. Again, that number was {0,-15}.", FormatCurrency(x, 2), y))
    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.ImageIndex = 1

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        Button12.ImageIndex = Button12.Tag
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Button6.Visible = False
    End Sub
End Class

Monday, March 1, 2010

another hw:
under strings, 3.4, even #s from 34 through 40, and 44

some code from class

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sentence As String
        sentence = "The rain in Spain falls mainly on the ground"
        Dim startpos, spacepos, wordlen As Integer
        startpos = 0
        spacepos = sentence.IndexOf(" ", startpos)
        wordlen = spacepos - startpos
        Debug.Print(sentence.Substring(startpos, wordlen))

        startpos = spacepos + 1
    End Sub
End Class