aspose file tools*
The moose likes Programming Diversions and the fly likes Puzzle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Puzzle" Watch "Puzzle" New topic
Author

Puzzle

Nilesh Parikh
Ranch Hand

Joined: Mar 14, 2000
Posts: 52
Hey All
I have a 5 Gallon and 3 gallon Water Containers and Lots of Water. How do I measure exaclty 4 Gallons of water. THe containers are not marked and I dont have any other Containers.
Alkesh
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
1. Fill the 3-gallon water container and pour it into the 5-gallon water container.
2. Fill the 3-gallon water container and pour it into the 5-gallon water container which already contains 3 gallons of water. This leaves 1 gallon of water in the 3-gallon water container.
3. Empty the 5-gallon water container and then add the 1 gallon of water from the 3-gallon container.
4. Fill the 3-gallon water container and add it to the 1 gallon of water in the 5-gallon container. Presto - 4 gallons of water!
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
I'm going to move this to Programming Diversions.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Puzzle