Wednesday, February 25, 2009

Chapter 3

1) dim price As Decimal
dim name As String

2) dim height As Decimal
dim width As Integer
dim name As String

3) city = "Miami"

4) dim sales1 As Decimal
dim sales2 As Decimal
dim totalSales As Decimal
totalSales = sales1 + sales2
totalSalesLabel.Text = totalSales

5) dim salary As Decimal
salary = salary * 1.5D
salaryLabel.Text = salary

6) dim employeename As String
'Must be entered in textbox
'Is module level variable

9) isConverted = Integer.TryParse(unitsTextBox.Text, numberOfUnits)

15) A variable whose value does not change during the program.

Chapter 4

7)

If carTextBox.text = "Grand Am" Then
carMakeLabel.text = "Pontiac"
End If

8)

If variable < 0 Then
MessageBox.Show("Entry Error", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Valid Number", "Valid Number", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

9)

If quantity < 10 then
MessageBox.Show("Reorder", "Reorder", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("OK", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

13)

If hours are less than or equal to 40 then multiply hours by hoursRate. Else, subtract forty, multiple the remainder by hoursRate and 1.5. Add 40 time by hourRate.

If hours < 40 Then
gross = hours*hourRate
Else
gross = (hours - 40) * hourRate * 1.5 + 40 * hourRate
End If

1 comment:

  1. Oval = Start + Stop
    Parallelogram = Input and Outputs
    Diamond = decisions, true/false, repetition
    Rectangles = your calculations, processes

    Cases, list one name and then each and every scenario.

    RNG: 1 to 4 for numbers between 1 and 4.

    ReplyDelete