Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. package com.krscode;
  2.  
  3. public class CoinTender {
  4.  
  5. public static String dispense(int input) {
  6. StringBuilder builder = new StringBuilder();
  7.  
  8. while (input > 5) {
  9. builder.append("N");
  10. input = input - 5;
  11. }
  12. while (input > 0) {
  13. builder.append("P");
  14. input = input - 1;
  15. }
  16.  
  17. return builder.toString();
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement