Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

The farmers puzzle for the chicken, fox and corn..!!

Thread view: 
mehul - 09 Nov 2005 11:53 GMT
Dear all..

I am trying to find  a way to graphically represent the following
puzzle... I will really appreciate it, if I can be provided with a JAVA
code for the following:

Farmer, chicken,fox and corn are one side of the river. They have a
boat on which at one time only one other person can ride along with the
farmer and cross the river.

However, the problem lies in the following:

If the farmer leaves the chicken and the fox together, fox eats the
chicken.
If the farmer leaves the chicken and the corn togethet, chcken eats the
corn.

I think loops,boolean and conditional statements would do the job.

Thanks a lot..

Mehul
Daniel Dyer - 09 Nov 2005 12:01 GMT
> Dear all..
>
[quoted text clipped - 16 lines]
>
> Thanks a lot..

Sure, and if you give me your Imperial College student number I'll even  
submit it for you to save you the effort.

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

mehul - 09 Nov 2005 13:52 GMT
Dont worry this aint a coursework....

Just got a new book in JAVA for self study..

Thanks anyway..
Eike Preuss - 09 Nov 2005 14:28 GMT
> Dont worry this aint a coursework....
>
> Just got a new book in JAVA for self study..

The one thing essential to self study is to do your exercises yourself...

> Thanks anyway..
TechBookReport - 09 Nov 2005 13:58 GMT
>> Dear all..
>>
[quoted text clipped - 21 lines]
>
> Dan.

He'll go far, obviously. He's posted questions and requests for help in
lots of news groups, without ever posting any work that he's done or
indicating that he's done any work at all.

I wonder if his lecturers ever look at these groups?
Oliver Wong - 09 Nov 2005 15:43 GMT
>>> Dear all..
>>>
[quoted text clipped - 16 lines]
>>>
>>> Thanks a lot..

   Since you're trying to represent the puzzle graphically, you might need
JPanel, Graphics2D, inheritance, threading, events, MouseListeners, layout
managers and class loaders too (among several other things).

   It sounds like you're just starting out. If so, I recommend you lay off
the graphics at first and concentrate more on the logic of getting the
program to give the correct answer (in textual form). Once you've got that
figured out, you can start worrying about GUIs.

   - Oliver
Wil Hadden - 09 Nov 2005 12:42 GMT
> Dear all..
>
[quoted text clipped - 18 lines]
>
> Mehul

In the logical set of all possible programs, the number of ways that problem
can be solved is enormous.

I can see in this set that your assertion of using loops, booleans and
conditional statments to be true, even to the extent that these mechanisms
are in some programs that use them extensively while not using any of them
to specifically solve or demonstrate the Farmer puzzle.

Top marks.
Roedy Green - 09 Nov 2005 13:33 GMT
>I am trying to find  a way to graphically represent the following
>puzzle... I will really appreciate it, if I can be provided with a JAVA
>code for the following:

see http://mindprod.com/jgloss/rule.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 09 Nov 2005 14:49 GMT
> I think loops,boolean and conditional statements would do the job.

In the words of Alex Trebek:  Can you be more specific?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.