CashMachine (part 10)

  • 40
  • Locked
Today we'll tackle WithdrawCommand. It's the most complex operation. 1. Implement the following algorithm for WithdrawCommand: 1.1. Read the currency code (the method already exists). 1.2. Get a manipulator for the specified currency.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Tony Roy
Level 41 , Victorville, United States
15 June 2020, 16:48
The conditions "fewest notes" and "largest bills" coincide for any reasonable currency -- but they come apart with odd denominations - as using 600, 500, 100 notes to withdraw 1000. Seems sufficient to suppose denominations are reasonable - and so that "greedy" strategy is good enough. Also, for WithdrawCommand, I got a(n obviously false) message from mentor that I was not calling ConsoleHelper.requestCurrencyCode. The problem went away when I stopped casting the map from withdrawAmount to a TreeMap, and created a new TreeMap instead!??! Spent a lot of time sorting through these requirements.