Question
I have a question with my program, and not sure how to get one thing to work. Write a program that represents these proverbs one
I have a question with my program, and not sure how to get one thing to work.
Write a program that represents these proverbs one at a time and asks the user to evaluate them as true or false. The program should then tell the user how many questions were answered correctly and display one of the following evaluation: Perfect (all correct), Excellent (5 or 6 correct), You might consider taking Psychology 101 (less than 5 correct).
So I have the code and that part works, its the part where it says Take quiz with a single button. I'm not sure how to do the single button and then make the rest of the assignment go.
My Code:
Public Class Form1
'Declare class ()variables To acces all the way In the program Dim Proverbs() As String = {"The squeaky wheel gets the grease", "Giving is better than receiving.", "Opposite attract.", "Spare the rod and spoil the child.", "Actions speak louder than words.", "Flattery will get you nowhere.", "Marry in haste, repent at leisure."} Dim Answers() As String = {"True", "True", "False", "False", "True", "False", "True"} Dim queNumber As Integer = 0 ' keeps track of question number Dim Score As Integer = 0 'Keeps track of the score Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'First question to start LblQuestion.Text = Proverbs(queNumber)
End Sub
Private Sub BtnSubmit_Click(sender As Object, e As EventArgs) Handles BtnSubmit.Click 'evaluates the answer and displays the next question If queNumber < Proverbs.Length Then Dim result As String If RbTrue.Checked Then result = "True" Else result = "False" End If If result.Equals(Answers(queNumber)) Then Score += 1 End If queNumber += 1 If queNumber <> Proverbs.Length Then LblQuestion.Text = Proverbs(queNumber) Else If Score = 7 Then MessageBox.Show("Perfect") ElseIf Score > 4 Then MessageBox.Show("Excellent") Else MessageBox.Show("You might consider taking Psychology 101") End If Score = 0 queNumber = 0 LblQuestion.Text = Proverbs(queNumber) End If End If End Sub
Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click Me.Close() 'To close form End Sub
End Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started