Question: Please use java Task 2 Write a function that gives change, i.e. it takes an amount as argument, and it prints out P's, N's, D's,

 Please use java Task 2 Write a function that gives change,

Please use java

Task 2 Write a function that gives change, i.e. it takes an amount as argument, and it prints out P's, N's, D's, and Q's - one for each penny (1 cent), nickle (5 cent), dime (10 cent) and quarter ( 25 cent) it gives out. Ex: If Amount is 33 , it would print out: QNPPP Your function should be recursive, and here's some simple rules to help you (let A be the amount you need change for): 1) If A is 0 , don't give anything! 2) If A>0, give out one of the largest denomination not exceeding A, then make change for the remaining amount

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!