Option Explicit
'Hassan Waheed
' exam
Private strAnswerReal1 As String
Private strAnswerReal2 As String
Private strAnswerReal3 As String
Private strAnswerReal4 As String
Private dblMoney As Double
Private dblQuestionAccumaltor As Double
Private Sub cmdInstructions_Click()
MsgBox "Hello, Player. Welcome to the who wants to be a" _
& " Hassanillionaire. You are gonna start off with $500 and" _
& " for every question you get right you gain $2000 but if" _
& " you get 1 question wrong then you lose $1000." _
& " Your goal is to win as much cash as you can."
End Sub
Private Sub cmdStart_Click()
dblMoney = 500
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
MsgBox " Get ready to wrestle your mind for a Million dollars"
If dblQuestionAccumaltor = 1 Then
Call Question1
End If
End Sub
Private Sub cmdAnswer1_Click()
If cmdAnswer1.Caption = strAnswerReal1 Or cmdAnswer1.Caption = strAnswerReal2 _
Or cmdAnswer1.Caption = strAnswerReal3 Or cmdAnswer1.Caption = strAnswerReal4 Then
MsgBox " you have won 2000 dollars"
dblMoney = dblMoney + 2000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
Else
MsgBox " Sorry, you have lost 500 dollars"
dblMoney = dblMoney - 1000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
End If
If dblQuestionAccumaltor = 2 Then
Call Question2
End If
If dblQuestionAccumaltor = 3 Then
Call Question3
End If
If dblQuestionAccumaltor = 4 Then
Call Question4
End If
End Sub
Private Sub cmdAnswer2_Click()
If cmdAnswer2.Caption = strAnswerReal1 Or cmdAnswer2.Caption = strAnswerReal2 _
Or cmdAnswer2.Caption = strAnswerReal3 Or cmdAnswer2.Caption = strAnswerReal4 Then
MsgBox " you have won 2000 dollars"
dblMoney = dblMoney + 2000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
Else
MsgBox " Sorry, you have lost 500 dollars"
dblMoney = dblMoney - 1000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
End If
If dblQuestionAccumaltor = 2 Then
Call Question2
End If
If dblQuestionAccumaltor = 3 Then
Call Question3
End If
If dblQuestionAccumaltor = 4 Then
Call Question4
End If
End Sub
Private Sub cmdAnswer3_Click()
If cmdAnswer3.Caption = strAnswerReal1 Or cmdAnswer3.Caption = strAnswerReal2 _
Or cmdAnswer3.Caption = strAnswerReal3 Or cmdAnswer3.Caption = strAnswerReal4 Then
MsgBox " you have won 2000 dollars"
dblMoney = dblMoney + 2000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
Else
MsgBox " Sorry, you have lost 500 dollars"
dblMoney = dblMoney - 1000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
End If
If dblQuestionAccumaltor = 2 Then
Call Question2
End If
If dblQuestionAccumaltor = 3 Then
Call Question3
End If
If dblQuestionAccumaltor = 4 Then
Call Question4
End If
End Sub
Private Sub cmdAnswer4_Click()
If cmdAnswer4.Caption = strAnswerReal1 Or cmdAnswer4.Caption = strAnswerReal2 _
Or cmdAnswer4.Caption = strAnswerReal3 Or cmdAnswer4.Caption = strAnswerReal4 Then
MsgBox " you have won 2000 dollars"
dblMoney = dblMoney + 2000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
Else
MsgBox " Sorry, you have lost 500 dollars"
dblMoney = dblMoney - 1000
lblYourMoney.Caption = "You Have" & Space(1) & dblMoney
lblQuestionBox.Caption = ""
cmdAnswer1.Caption = ""
cmdAnswer2.Caption = ""
cmdAnswer3.Caption = ""
cmdAnswer4.Caption = ""
dblQuestionAccumaltor = dblQuestionAccumaltor + 1
End If
If dblQuestionAccumaltor = 2 Then
Call Question2
End If
If dblQuestionAccumaltor = 3 Then
Call Question3
End If
If dblQuestionAccumaltor = 4 Then
Call Question4
End If
End Sub
Sub Question1()
lblQuestionBox.Caption = "When was pakistan first made?"
cmdAnswer1.Caption = " 1947 "
cmdAnswer2.Caption = " 1961 "
cmdAnswer3.Caption = " 1945 "
cmdAnswer4.Caption = " 1955 "
strAnswerReal1 = "1947"
End Sub
Sub Question2()
lblQuestionBox.Caption = "Who comes on christams day?"
cmdAnswer1.Caption = " Santa flaws "
cmdAnswer2.Caption = " Santa Ben "
cmdAnswer3.Caption = " Santa Jonas "
cmdAnswer4.Caption = " Santa claus "
strAnswerReal2 = "Santa claus"
End Sub
Sub Question3()
lblQuestionBox.Caption = "What is the most common substance found" _
& "on the planet earth?"
cmdAnswer1.Caption = " Water "
cmdAnswer2.Caption = " Gold "
cmdAnswer3.Caption = " Diamond "
cmdAnswer4.Caption = " Humans "
strAnswerReal3 = "Water"
End Sub
Sub Question4()
lblQuestionBox.Caption = "Who was the leader of German the Nazi party?" _
& "on the planet earth?"
cmdAnswer1.Caption = " Himler "
cmdAnswer2.Caption = " Jospeh Stalin "
cmdAnswer3.Caption = " Field Marshal Rommel "
cmdAnswer4.Caption = " Adolf Hitler "
strAnswerReal4 = "Adolf Hitler"
End Sub