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

Implement in Java, I use eclipse. Using trees as the data structure, implement a

ID: 3560733 • Letter: I

Question

Implement in Java, I use eclipse.

Using trees as the data structure, implement a 20 question game. Game should be specific like the 'Animal question game'. Could be 20 levels(questions) or 7. For example, the user thinks of an animal and the computer should ask 'yes' or 'no' questions until it "thinks" that it knows the answer. If computer guesses correctly, computer wins. If incorrectly, the user wins.

Brief example: (human thinks of a 'dog' and the computer guesses

Computer: Does it have a tail?

User: Yes

Computer: Does it bark?

User: Yes

Computer: Is the animal a dog?

User: Yes (COMPUTER WINS)

Note: Minimum 20 questions...

Explanation / Answer

SQL> create table qs 2 ( q_id integer primary key 3 , parent_q_id integer references qs 4 , parent_q_answer varchar2(1) 5 , q_text varchar2(100) 6* ); Table created. SQL> insert into qs values (1, null, null, 'Is it bigger than a person?'); 1 row created. SQL> insert into qs values (2, 1, 'Y', 'Does it have a long neck?'); 1 row created. SQL> insert into qs values (3, 2, 'Y', 'It is a giraffe'); 1 row created. SQL> insert into qs values (4, 2, 'N', 'It is an elephant'); 1 row created. SQL> insert into qs values (5, 1, 'N', 'Does it eat cheese?'); 1 row created. SQL> insert into qs values (6, 5, 'Y', 'It is a mouse'); 1 row created. SQL> insert into qs values (7, 5, 'N', 'It is a cat'); 1 row created. SQL> commit; Commit complete. SQL> select rpad(' ',level*4,' ')||parent_q_answer||': '||q_text 2 from qs 3 start with parent_q_id is null 4 connect by prior q_id = parent_q_id; RPAD('',LEVEL*4,'')||PARENT_Q_ANSWER||':'||Q_TEXT ------------------------------------------------------------------------------------------------------------------------------ : Is it bigger than a person? Y: Does it have a long neck? Y: It is a giraffe N: It is an elephant N: Does it eat cheese? Y: It is a mouse N: It is a cat 7 rows selected.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote