Can someone please help me. I have been working on trying to fix my IF Statements since 6.00 pm yesterday and it has been bugging me so much. I've literally tried everything I know to fix these IF Statements but nothing has worked.
Module Module1 Dim Place1, PrivetDrive, Dursley, four, choice As String Sub Main() Do Console.WriteLine("Press 1 to read the story: ") Console.WriteLine("Press 2 to take a test on the story: ") Console.WriteLine("Press 3 to find out your score: ") Console.WriteLine("Press 4 to exit: ") choice = Console.ReadLine() Console.WriteLine("You have selected option... {0} ", choice) Select Case choice Case "1" Console.Write("Mr. and Mrs. Dursley, of number four, PrivetDrive, were proud to say that they were perfectly normal, thank you very much. They were the last people you'd expect to be involved in anything strange or mysterious, because they just didn't hold with such nonsense.") Place1 = Console.ReadLine() Case "2" Dim Place As String = StrConv(Console.ReadLine, VbStrConv.ProperCase) Console.Write("What was the couples last name? ") Console.ReadLine() If Place = Dursley Then Console.WriteLine("You got it right!") Else Console.WriteLine("You got it wrong!") End If Console.Write("What house number did they live at? ") Console.ReadLine() If Place = four Then Console.WriteLine("This is correct! You get one point.") Else Console.WriteLine("That is wrong.") Console.Read() End If Console.Write("What street did they live in? ") Place = Console.ReadLine() If Place = PrivetDrive Then Console.WriteLine("You got it right!") Else Console.WriteLine("That is wrong.") End If Case "3" End Select Loop Until choice = "4" Console.Read() End Sub End Module
At the moment no matter what answer I type in for the questions, it just says I've got it right. When I put the answer bit of the IF Statements in quotation marks:
Case "2" Dim Place As String = StrConv(Console.ReadLine, VbStrConv.ProperCase) Console.Write("What was the couples last name? ") Console.ReadLine() If Place = "Dursley" Then Console.WriteLine("You got it right!") Else Console.WriteLine("You got it wrong!") End If Console.Write("What house number did they live at? ") Console.ReadLine() If Place = "four" Then Console.WriteLine("This is correct! You get one point.") Else Console.WriteLine("That is wrong.") Console.Read() End If Console.Write("What street did they live in? ") Place = Console.ReadLine() If Place = "PrivetDrive" Then Console.WriteLine("You got it right!") Else Console.WriteLine("That is wrong.") End If
And then run the application, it just says I've got it wrong.
Another thing I've been trying to do is once the user has answered the questions and then they select option '3', they can find out what score they got. But I've been really struggling to write a code where the application can do this. So any tips or advice on how to would be extremely helpful.
Thanks!