Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Table 5.17 contains seven proverbs and their truth values. Write a program that

ID: 3656571 • Letter: T

Question

Table 5.17 contains seven proverbs and their truth values. Write a program that presents 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 evaluations: Perfect (all correct), Excellent (5 or 6 correct), You might consider taking Psychology 101 (less than 5 correct). Proverb Truth Value The squeaky wheel gets the grease. True Cry and you cry alone. True Opposites attract. False Spare the rod and spoil the child. False Actions speak louder than words. True Marry in haste, repent at leisure. False Familiarity breeds contempt. true

Explanation / Answer

Private Sub btnQuestions_Click(sender As System.Object, e As System.EventArgs) Handles btnQuestions.Click Dim i As Integer Dim Result As String = Nothing Dim YN As DialogResult Dim total As Integer = 0 Dim questions() As String = {"The squeaky wheel gets the grease.", "Cry and you cry alone.", "Opposites attract.", "Spare the rod and spoil the child.", "Actions speak louder than words.", "Marry in haste, repent at leisure.", "Familiarity breeds contempt."} Dim ans() As Boolean = {True, True, False, False, True, False, True} For i = 0 To 6 YN = MessageBox.Show(questions(i), "True or False", MessageBoxButtons.YesNo, MessageBoxIcon.None) If YN = vbYes And ans(i) = True Then total += 1 ElseIf YN = vbNo And ans(i) = False Then total += 1 End If Next Select Case total Case Is < 5 Result = "You might consider taking Psychology 101" Case 5, 6 Result = "Excellent" Case 7 Result = "Perfect" End Select MessageBox.Show(Result, "Result", MessageBoxButtons.OK, MessageBoxIcon.None) End Sub