Twenty questions

On Github

  1. Navigate to your Github repo on github.com

  2. Switch to the branch projects/twenty-questions (menu on left top)

  3. Click the green Code button

  4. Click the Codespaces tab

  5. Click the + to create a new codespace.

In the codespace

  1. Wait for the codespace to open up.

  2. In the file navigator on the left open up projects/twenty-questions

  3. Right click on TwentyQuestions.java and choose “Open in Integrated Terminal”

  4. In the terminal, type java TwentyQuestions.java

Is it an elephant?

  1. It should print “Is it an elephant?”

  2. Type “y” and hit return.

Now make it better!

As it stands, this program plays a boring game of One Question. You should extend it, by creating nested if/else pairs to at least Three Questions.

The code will be pretty repetitive at this point. That’s okay. Feel free to make it better if you see a way but we’ll talk about that as a class later.