Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am programming a Quiz with C# and need to foolproof the code by disallowing improper input values and display an error message while giving
I am programming a Quiz with C# and need to foolproof the code by disallowing improper input values and display an error message while giving the user a chance to repeat the input. I also need to stop my code from infinitely looping after the second round of questions! I believe its called a "break" but I'm n ot sure, I could not figure it out!
Here are screenshots of my current code. Please include the output in your response! Thx!
Debug> Default Visual Studio Community 2017 for Mac Press '3 to se Program.cs ProgramMaintstringD args) using System namespace MOD4._2 class Program static void Main(string args) stringt questions("Is a rainbow an arch of color?", 10 12 13 14 15 16 17 18 19 20 21 "Is a rainbow caused by reflaction of Light?", "What is the darivative of rainbow's refraction?", How many colors are typically associated with rainbow?", "Is there such thing as a double rainbow?", "Where are rainbow Located?", "What Initiliasim associates themselves with rainbows?", "There is a Rainbow Road level in what vadio game?", "Is the color Black ever included in raibows?"', 23 24 25 26 ""What may you find at the end of the rainbow?" 27 28 string answerChoice "Yes,No" 30 31 32 "Rain or Water, Grass, People,0ther Rainbow" 7,5,12,6", "Yes,No" "North,South, No Specific Location,ALong the equator "LGBTQ, FBI,NFL,NASA" 34 36 37 38 39 40 41"Donkey Kong, Mega Man,Mario Kart,Final Fanytasy", 42 43 "Yes,No" 45"Trash, Your Houese, YMCA,Pot of Gold" 46 string[] rightAnswer { "Yes", "Yes", "Rain Console.WriteLine Simple Quiz Outline."); Console.WriteLine("Your name here?") or Water", "7", "Yes", "No Specific Location' "LGBTQ", "Mario Kart", "No", "Pot of Gold" }; 48 49 50 51 52 DebugDefault Visual Studio Community 2017 for Mac Pr Program.cs Program D Main(string[] args) - 52 53 54 56 57 58 59 60 61 62 63 64 65 var name = Console.ReadLine(); Console.WriteLine("What is this cource?"); var course Console.ReadLine(); Console.WriteLine("What is today's date?"); var date = Console.ReadLine(); ar count = 10; while (true) 67 68 69 70 71 72 73 74 75 76 var correct 0; for int 0; i questions . Length; i++)
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