i need help writing a program where i input a Cent vaule and it should give me a value in how many ways can u create change for it in half dollars,quarters, nickels, dimes, pennys. for example if i typed 100 which is one dollar it should say 292. this is what i have now im a noob soo someone help me write it.
class Change
{
public static void main(String args[]) {
keyboard key=new keyboard();
I would use a recursive approach for this problem. here is the logic:
int changeCombinationNumber(int change)
if it is less then 5 return 1;(ve are returning 1 because if it less then 5 there is only one possibility you can only use cents this is out escape from recursife loop)
if chance>50 return changeCombinationNumber(50)*changeCombinationNumber(change-50)
else if change>25 return changeCombinationNumber(25)*changeCombinationNumber(change-25)
etc...
ok for example if it is 25 change will also be onlay a quatter. add that control to your algorithm..it hass a lot of missing part but thats how I would start, I hope thats help
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.