' Mr. Minich
' Period 1
' Ch3Demo3
' 9/14/2000
' Purpose - This program demonstrates the use of declaration & assignment statements.
Option Explicit
Private Sub Form_Activate()
' constant declaration statement *************************************************
Const sngPA_SALES_TAX As Single = 1.06 ' Pennsylvania state sales tax
' variable declaration statements ************************************************
Dim sngMilk As Single ' price of one gallon of milk
Dim sngCereal As Single ' price of one box of cereal
Dim sngBanana As Single ' price of one pound of bananas
Dim sngCompactDisc As Single ' price of a compact disc
Dim sngTotalBill As Single ' customer's total bill at checkout counter
' assignment statements **********************************************************
sngMilk = 2.77
sngCereal = 3.59
sngBanana = 1.05
sngCompactDisc = 16.99
sngTotalBill = (sngMilk + sngCereal + sngBanana) + sngCompactDisc * sngPA_SALES_TAX
' sales tax does not apply to food in Pennsylvania
' displaying the output **********************************************************
frmMain.Print "Your total bill is " & sngTotalBill
frmMain.Print
frmMain.Print "Have a good day!"
End Sub
' 1. Circle one - Yes or No - The parentheses are absolutely necessary in the
' sixth assignment statement.
' 2. Show the intermediate values of the following variables. Be careful with curTotalBill.
' sngMilk sngCereal sngBanana sngCompactDisc sngTotalBill
' ------- --------- --------- -------------- ------------