Main

 


AUTO COMPUTE TOTAL
'Programer: C Maruca Bagel, Salad, Soda
Option Explicit
Dim BPrice As Currency
Dim S1Price As Currency
Dim S2Price As Currency
Dim Bagel As Currency
Dim Salad As Currency
Dim Soda As Currency
Dim TotalPrice As Currency
Private Sub chkBagel_Click()
If chkBagel.Value = vbChecked Then
BPrice = 2.25
fraBox2.Visible = True
fraBox2.Enabled = True
lblBagelPrice.Visible = True
End If
If chkBagel.Value = vbUnchecked Then
fraBox2.Visible = False
fraBox2.Enabled = False
lblBagelPrice.Visible = False
lblBagelPrice.Caption = ""
chkCreamCheese.Value = False chkLox.Value = False
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
Bagel = lblBagelPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub chkLox_Click()
If chkLox.Value = vbChecked Then
BPrice = BPrice + 1.2
End If
If chkLox.Value = vbUnchecked Then
BPrice = BPrice - 1.2
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
Bagel = lblBagelPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub chkCreamCheese_Click()
If chkCreamCheese.Value = vbChecked Then
BPrice = BPrice + 1#
End If
If chkCreamCheese.Value = vbUnchecked Then
BPrice = BPrice - 1
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
Bagel = lblBagelPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub chkSalad_Click()
If chkSalad.Value = vbChecked Then
fraBox3.Visible = True
fraBox3.Enabled = True
lblSaladPrice.Visible = True
End If
End Sub
Private Sub chkSoda_Click()
If chkSoda.Value = vbChecked Then
fraBox4.Visible = True
fraBox4.Enabled = True
lblSodaPrice.Visible = True
End If
End Sub
Private Sub Form_Load()
optSpinach.Value = False
optChef.Value = False
optCola.Value = False
optCreamSoda.Value = False
End Sub
Private Sub optSpinach_Click()
S1Price = 2.75
lblSaladPrice.Caption = FormatCurrency(S1Price, 2)
Salad = lblSaladPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub optChef_Click()
S1Price = 3.25
lblSaladPrice.Caption = FormatCurrency(S1Price, 2)
Salad = lblSaladPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub optCola_Click()
S2Price = 1.25
lblSodaPrice = FormatCurrency(S2Price, 2)
Soda = lblSodaPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub optCreamSoda_Click()
S2Price = 1.25
lblSodaPrice.Caption = FormatCurrency(S2Price, 2)
Soda = lblSodaPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub


BAGEL WITH COMMAND BUTTON

'Programer: C Maruca Bagel, Salad, Soda
Option Explicit
Dim BPrice As Currency
Dim S1Price As Currency
Dim S2Price As Currency
Dim Bagel As Currency
Dim Salad As Currency
Dim Soda As Currency
Dim TotalPrice As Currency

Private Sub chkBagel_Click()
If chkBagel.Value = vbChecked Then
BPrice = 2.25
fraBox2.Visible = True
fraBox2.Enabled = True
lblBagelPrice.Visible = True
End If
If chkBagel.Value = vbUnchecked Then
fraBox2.Visible = False
fraBox2.Enabled = False
lblBagelPrice.Visible = False
lblBagelPrice.Caption = ""
chkCreamCheese.Value = False
chkLox.Value = False
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
End Sub
Private Sub chkLox_Click()
If chkLox.Value = vbChecked Then
BPrice = BPrice + 1.2
End If
If chkLox.Value = vbUnchecked Then
BPrice = BPrice - 1.2
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
End Sub
Private Sub chkCreamCheese_Click()
If chkCreamCheese.Value = vbChecked Then
BPrice = BPrice + 1#
End If
If chkCreamCheese.Value = vbUnchecked Then
BPrice = BPrice - 1
End If
lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
End Sub
Private Sub chkSalad_Click()
If chkSalad.Value = vbChecked Then
fraBox3.Visible = True
fraBox3.Enabled = True
lblSaladPrice.Visible = True
End If
End Sub
Private Sub chkSoda_Click()
If chkSoda.Value = vbChecked Then
fraBox4.Visible = True
fraBox4.Enabled = True
lblSodaPrice.Visible = True
End If
End Sub
Private Sub cmdComputeTotal_Click()
Bagel = lblBagelPrice.Caption
Salad = lblSaladPrice.Caption
Soda = lblSodaPrice.Caption
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
Private Sub Form_Load()
optSpinach.Value = False
optChef.Value = False
optCola.Value = False
optCreamSoda.Value = False
End Sub
Private Sub optSpinach_Click()
S1Price = 2.75
lblSaladPrice.Caption = FormatCurrency(S1Price, 2)
End Sub
Private Sub optChef_Click()
S1Price = 3.25 lblSaladPrice.Caption = FormatCurrency(S1Price, 2)
End Sub
Private Sub optCola_Click()
S2Price = 1.25
lblSodaPrice = FormatCurrency(S2Price, 2)
End Sub
Private Sub optCreamSoda_Click()
S2Price = 1.25
lblSodaPrice.Caption = FormatCurrency(S2Price, 2)
End Sub


'Programer: cMaruca; Bagel Cmd w/If Then Logic, message
Option Explicit
Dim BPrice As Currency
Dim S1Price As Currency
Dim S2Price As Currency
Dim TotalPrice As Currency
Dim Bagel As Currency
Dim Salad As Currency
Dim Soda As Currency
Private Sub chkBagel_Click()
If chkBagel.Value = vbChecked Then
fraBox2.Visible = True
fraBox2.Enabled = True
lblBagelPrice.Visible = True
BPrice = 2.25
End If
lblBagelPrice.Caption = BPrice
End Sub
Private Sub chkSalad_Click()
If chkSalad.Value = vbChecked Then
fraBox3.Visible = True
fraBox3.Enabled = True
lblSaladPrice.Visible = True
End If
End Sub
Private Sub chkSoda_Click()
If chkSoda.Value = vbChecked Then
fraBox4.Visible = True
fraBox4.Enabled = True
lblSodaPrice.Visible = True
End If
End Sub
'Command Button Hot
Private Sub cmdComputeTotal_Click()
If chkLox.Value = vbChecked Then
BPrice = BPrice + 1.2
End If
If chkCreamCheese.Value = vbChecked Then
BPrice = BPrice + 1
End If
'Salad
If optSpinach.Value = True Then
S1Price = 2.75
ElseIf optChef.Value = True Then
S1Price = 3.25
ElseIf chkSalad.Value = vbChecked Then
MsgBox "PLEASE MAKE A SELECTION. FAILURE TO DO SO WILL RESULT IN DEFAULT AND YOU WILL RECEIVE TODAY'S SPECIAL! SPAM,EGGS,SPAM,SPAM,SPAM,AND SPAM!!" Exit Sub
End If
'Soda
If optCola.Value = True Then
S2Price = 1.25
ElseIf optCreamSoda.Value = True Then
S1Price = 1.25
ElseIf chkSoda.Value = vbChecked Then
MsgBox "PLEASE SELECT A BEVERAGE."
Exit Sub
End If
'Total Line Items lblBagelPrice.Caption = FormatCurrency(BPrice, 2)
lblSaladPrice.Caption = FormatCurrency(S1Price, 2)
lblSodaPrice.Caption = FormatCurrency(S2Price, 2)
'Variables
Bagel = lblBagelPrice.Caption
Salad = lblSaladPrice.Caption
Soda = lblSodaPrice.Caption
'Grand Total
TotalPrice = Bagel + Salad + Soda
lblTotal.Caption = FormatCurrency(TotalPrice, 2)
End Sub
'Setup
Private Sub Form_Load()
optSpinach.Value = False
optChef.Value = False
optCola.Value = False
optCreamSoda.Value = False
End Sub

EMPLOYEE BONUS CONVERTING VALUES INTO STRING (VALID, INVALID)

'Programer: C Maruca Option Explicit
Dim IName As String Dim Salary As Currency Dim InSalary As String Dim InExperience As String Dim Experience As Currency Dim InDepartment As String Dim InTitle As String


Private Sub Form_Load()
Form1.Show
'Get Name

IName = InputBox("Enter a Name")
txtName.Text = IName

If Len(IName) > 18 Or Len(IName) = 0 Then
lblIName.Caption = "Not Valid"
Else: lblIName.Caption = "Valid"
End If

'Salary
InSalary = InputBox("Give me a Salary")
txtSalary.Text = InSalary
If Not IsNumeric(InSalary) Then
lblSalary.Caption = "Not Valid"
Else
Salary = Val(txtSalary.Text)
If Salary >= 10000 And Salary <= 150000 Then
lblSalary.Caption = "Valid"
Else: lblSalary.Caption = "Not Valid"
End If
End If


'Years of Experience
InExperience = InputBox("Number of Years Employed")
txtYears.Text = InExperience
If Not IsNumeric(InExperience) Then
lblYears.Caption = "Not Valid" Else
Experience = Val(lblYears.Caption)
If Experience >= 0 And Experience <= 75 Then
lblYears.Caption = "Valid"
Else
lblYears.Caption = "Not Valid"
End If
End If


'Department
InDepartment = InputBox("Indicate Your Department")
txtCode.Text = InDepartment
If UCase(InDepartment) = "PROD" Or UCase(InDepartment) = "ACCTG" Or UCase(InDepartment) = "MKTG" Then
lblDepartmentCode = "Valid"
Else
lblDepartmentCode = "Not Valid"
End If

'Title
InTitle = InputBox("Enter your Title")
txtTitle.Text = InTitle
If UCase(InTitle) = "MGR" Or UCase(InTitle) = "SUPERVISOR" Or UCase(InTitle) = "STAFF" Or UCase(InTitle) = "Auditor" Then
lblTitle = "Valid"
Else
lblTitle = "Not Valid"
End If

'Form 2
If lblIName.Caption = "Valid" And lblSalary.Caption = "Valid" And lblYears.Caption = "Valid" And lblDepartmentCode.Caption = "Valid" And lblTitle.Caption = "Valid" Then
frmTip.Show
End If
If lblIName.Caption = "Valid" And lblSalary.Caption = "Valid" And lblYears.Caption = "Valid" And lblDepartmentCode.Caption = "Valid" And lblTitle.Caption = "Valid" Then
frmTip.Show
End If
End Sub



CALC BONUS WITH OPT AND CHK BOX

'Programer: C Maruca
'BONUS CALC WITH OPT & CHK BOX
Option Explicit
Dim Years As Currency
Dim Level As Currency
Dim Service As Currency
Dim Salary As Currency
Dim Ratio As Currency
Dim Bonus As Currency
Dim Name1 As String

Private Sub chkService_Click()
If chkService.Value = vbChecked Then
Service = 100
Else
Service = 0
End If
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub

Private Sub Form_Load()
opt1.Value = False
opt2.Value = False
opt3.Value = False
optLevel1.Value = False
optLevel2.Value = False
optLevel3.Value = False
End Sub

Private Sub opt1_Click()
Years = 100
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub opt2_Click()
Years = 200
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub opt3_Click()
Years = 350
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub optLevel1_Click()
Level = 75
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub optLevel2_Click()
Level = 100
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub optLevel3_Click()
Level = 125
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub
Private Sub txtName_Change()
Name1 = txtName.Text
frmEmployee.Caption = Name1
End Sub
Private Sub txtSalary_Change()
Salary = txtSalary.Text
Ratio = Salary * 0.05
lblOutput.Caption = FormatCurrency(Ratio + Years + Level + Service, 2)
End Sub


TIC-TAC-TOE
Option Explicit
Dim X As String
Dim O As String
Dim Player As String
Dim Winner As String
Dim Response As Integer
Private Sub cmd1_Click()
cmd1.Caption = Player
cmd1.Enabled = False
If Player = "X" Then
Player = "O"
Else
Player = "X"
End If
If cmd1.Caption = cmd2.Caption And cmd1.Caption = cmd3.Caption Then
Winner = cmd1.Caption
ElseIf cmd1.Caption = cmd5.Caption And cmd1.Caption = cmd9.Caption Then
Winner = cmd1.Caption
ElseIf cmd1.Caption = cmd4.Caption And cmd1.Caption = cmd7.Caption Then
Winner = cmd1.Caption
End If
If Winner = cmd1.Caption Then
MsgBox "Winner is" & Winner
End If
Private Sub cmdReset_Click()
Player = X
cmd1.Caption = ""
cmd2.Caption = ""
cmd3.Caption = ""
cmd4.Caption = ""
cmd5.Caption = ""
cmd6.Caption = ""
cmd7.Caption = ""
cmd8.Caption = ""
cmd9.Caption = ""
Winner = ""
cmd1.Enabled = True
cmd2.Enabled = True
cmd3.Enabled = True
cmd4.Enabled = True
cmd5.Enabled = True
cmd6.Enabled = True
cmd7.Enabled = True
cmd8.Enabled = True
cmd9.Enabled = True
End Sub
Private Sub Form_Load()
Player = "X"
End Sub