| | |
I cant get this program compiled !!!!!
![]() |
•
•
Join Date: Apr 2007
Posts: 1
Reputation:
Solved Threads: 0
An island has two kinds of inhabitants:
Knights: Always tell the truth
Knaves: Always Lie
You encounter two people A and B. You ask the user to enter what A and B say. Your program
should output the conclusions (if possible) about the identities of A and B.
For example (done in class):
-----------------------------------------------------------------
-----------------------------------------------------------------
Solving the ISLAND PUZZLE program
-----------------------------------------------------------------
-----------------------------------------------------------------
Please enter what A says: B is a knight
Please enter what B says: The two of us are of opposite types
-----------------------------------------------------------------
-----------------------------------------------------------------
The result that we can conclude is:
A is a knave
B is a knave
-----------------------------------------------------------------
-----------------------------------------------------------------
Some answers you MIGHT expect from the user concerning what A and B say are:
1- Nothing (i.e. one of them simply says nothing)
2- At least one of us is a knave
3- At least one of us is a knight
4- We are both knights
5- We are both knaves
6- A is a knave
7- B is a knave
8- A is a knight
9- B is a knight
10- I am a knight
11- I am a knave
Knights: Always tell the truth
Knaves: Always Lie
You encounter two people A and B. You ask the user to enter what A and B say. Your program
should output the conclusions (if possible) about the identities of A and B.
For example (done in class):
-----------------------------------------------------------------
-----------------------------------------------------------------
Solving the ISLAND PUZZLE program
-----------------------------------------------------------------
-----------------------------------------------------------------
Please enter what A says: B is a knight
Please enter what B says: The two of us are of opposite types
-----------------------------------------------------------------
-----------------------------------------------------------------
The result that we can conclude is:
A is a knave
B is a knave
-----------------------------------------------------------------
-----------------------------------------------------------------
Some answers you MIGHT expect from the user concerning what A and B say are:
1- Nothing (i.e. one of them simply says nothing)
2- At least one of us is a knave
3- At least one of us is a knight
4- We are both knights
5- We are both knaves
6- A is a knave
7- B is a knave
8- A is a knight
9- B is a knight
10- I am a knight
11- I am a knave
![]() |
Similar Threads
- my program is compiled.but on run that i have message "Exception in thread "main" jav (Java)
- Can't get program to compile (C++)
- Need advice & help with a very simple program (IT Professionals' Lounge)
- Phonebook program! (C)
- PLEASE HELP about Using C# to add an executable file to my program! (C#)
- Program alone doesn't help. (C++)
- Can any1 tell me whatz wrong in this program...this does not show the output!!! (C++)
- Cant execute a c++ program (C++)
Other Threads in the Java Forum
- Previous Thread: wanna learn java
- Next Thread: help installing java?
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






