Thursday, September 12, 2002

alright then, so now it is approx 11:00 am Baldwin-Wallace time. which means I am pretty tired.

so far today I have been to my 8:25 Fundamentals of Computer Science class...thats right folks.

which means I have been sitting in my room for the past hour, on my computer, putting little lines of code into a (pretty basic and simple comparatively to the normal programming languages) visual basic application.

just to give you guys a taste of what that is like...here is a program:


Option Explicit



Private Sub cmdCalc_Click()
Dim Owes As Double
Dim Paid As Double
Dim Pennies As Double
Dim FDollars As Double
Dim FQuarters As Double
Dim FDimes As Double
Dim FNickles As Double
Dim FPennies As Double

'Input
Owes = Val(txtOwes.Text)
Paid = Val(txtPaid.Text)
Pennies = (Paid - Owes) * 100

'Calculations
FDollars = Pennies \ 100
Pennies = Pennies Mod 100

FQuarters = Pennies \ 25
Pennies = Pennies Mod 25

FDimes = Pennies \ 10
Pennies = Pennies Mod 10

FNickles = Pennies \ 5
Pennies = Pennies Mod 5

'Display
lblFPennies.Caption = Pennies
lblFDollars.Caption = FDollars
lblFQuarters.Caption = FQuarters
lblFDimes.Caption = FDimes
lblFNickles.Caption = FNickles
End Sub


Private Sub cmdClear_Click()
lblFPennies.Caption = ""
lblFDollars.Caption = ""
lblFQuarters.Caption = ""
lblFDimes.Caption = ""
lblFNickles.Caption = ""
txtOwes.Text = ""
txtPaid.Text = ""
txtOwes.SetFocus
End Sub


Private Sub cmdExit_Click()
End
End Sub


Private Sub cmdPrint_Click()
cmdCalc.Visible = False
cmdPrint.Visible = False
cmdClear.Visible = False
cmdExit.Visible = False
PrintForm
cmdCalc.Visible = True
cmdPrint.Visible = True
cmdClear.Visible = True
cmdExit.Visible = True
End Sub


which eventually looks like this

there you have it. that is a program to calculate change given by a customer, if you look carefully (which I hope you don't do) then you can see it also has the buttons for Printing and Clear Screen...also Exit

MUAHAHAHA TASTE THE FUN!!

TASTE IT!

0 Comments:

Post a Comment

<< Home