Imagine that you have 2 jugs, a small one and a large one, with integer capacities of sCap and lCap gallons, respectively (sCap < lCap).
Initially both jugs are empty.
You are allowed to completely fill each jug from a tap, or empty them on the ground.
You can also pour one jug into the other: pouring stops when either the receiving jug is full or no water is left in the pouring jug (i.e. no water is spilled).
Note that each pouring action will cause a positive number of whole gallons to be transferred.
Given the final state of the jugs, the problem is to find a valid sequence of actions such that after performing the actions, the small and large jugs show exactly the final state given.
Input: capacity of jug A, capacity of jug B, desired output
Output: current state of the jugs, steps in solving the problem
Important: Your group must use RECURSION in solving the problem.
looks like a homework copypaste.. try putting some effort in first before asking for help, and when you do that, you might want to put some effort into your post too, i mean; letting us know where you are struggling to solve your problem specifically. no-one is going to do your homework for you, or at least i would hope not D:
yes, it is a homework from my programming subject.my problem is i dont know how to program it using java creator,but i know how it works in algorithm..
sorry for the format,
this is the output of my program.. node the java code itself..