While Loop Quiz

Your Task:

Create a quiz that keeps asking one or more questions until a valid answer is received.

Requirements:

  • Use a while loop to keep repeating the question as many times as necessary.
  • Use a condition that allows at least two different correct answers to the question(s).
  • Use String methods such as .equals() or .contains() or .indexOf() to check if the response is valid.
  • If the answer is invalid, tell the user that the answer is invalid and ask the question again (inside the while loop)
  • Indentation on your code must be good: use tabs to show when a code block is inside another code block (nesting).