RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 448 | Replies: 1
Reply
Join Date: Apr 2007
Posts: 1
Reputation: n3zor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
n3zor n3zor is offline Offline
Newbie Poster

Help I cant get this program compiled !!!!!

  #1  
Apr 29th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 19
Solved Threads: 200
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: I cant get this program compiled !!!!!

  #2  
Apr 30th, 2007
that's not a program, that's the assignment for your homework.
First you have to write a program before you can compile it.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:15 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC