Wednesday, October 27, 2010

lecture notes

Visual Basic, If statement

decision making
VB program to calculate semester avg
input?
output?

Private Sub cmdCalculate_Click()
    Dim semesterAverage As Integer
    Dim midterm As Integer
    Dim final As Integer
    Dim bribe As Integer
  
    ' get input
    midterm = txtMidterm.Text
    final = txtFinal.Text
    bribe = Val(txtBribe.Text)
  
    ' processing
    If bribe >= 50 Then
        semesterAverage = 100
    Else
       semesterAverage = (midterm + final) / 2
    End If
  
    ' output results
    cmdCalculate.Caption = semesterAverage
End Sub

HW: Make a greeting line, where if
the Title is absent,
 do something intelligent

HW: In Word MergeFields, use an If Else.
If the person has a pet, inquire about the
pet's well-being, by name. Otherwise, suggest
that they adopt a pet.

Excel
self-documenting
using the Name box
default is to name Absolute References

HW: In excel, using an If, taking in midterm, final, bribe, calculate semester average
Use names for it. All you need to submit is the formula, not a whole spreadsheet

=IF(Subtotal>=100, (Subtotal+TaxAmt)*DiscountPercentage, 0)
=(Subtotal>=100)*(Subtotal+TaxAmt)*DiscountPercentage
It turns out that TRUE is 1.
It turns out that FALSE is 0.

Nesting

HW: Using nesting, calculate a 20% discount
for over $200, a 10% discount for over $100,
otherwise, nothing

Web
Styles are defined within CSS
Cascading Style Sheets
http://www.w3schools.com/css/css_intro.asp

selector declaration
p {color:red;text-align:center;}

Quiz two mondays from now, only up to this lecture

1 comment:

  1. will the hw be posted on blackboard for us to submit it there?

    ReplyDelete