Failed to initialized res field in DepositCommand, ExitCommand & InfoCommand. Additionally failed to use the appropriate resources in the execute() method in those classes.
You've already figured out ResourceBundle! Cool!
Now we can add localization, i.e. support for multiple languages.
1. In DepositCommand, ExitCommand, and InfoCommand, add a private ResourceBundle res field and initialize it with the appropriate resource.
For DepositCommand, use deposit_en.properties.
For ExitCommand, use exit_en.properties.
For InfoCommand, use info_en.properties.
Important: build the path to the resources dynamically using the CashMachine class's getPackage() method
2. For each new resource, replace all the strings in the corresponding command.
Requirements:
DepositCommand must have a private ResourceBundle res field.
ExitCommand must have a private ResourceBundle res field.
InfoCommand must have a private ResourceBundle res field.
The DepositCommand class's res field must be initialized from the deposit_en.properties file.
The ExitCommand class's res field must be initialized from the exit_en.properties file.
The InfoCommand class's res field must be initialized from the info_en.properties file.
Use the appropriate resources in the execute() method of the DepositCommand, ExitCommand, and InfoCommand classes.
Plus, for me it worked without taking into consideration the "%s" or "%d";
Like, for example, in the DepositCommand class I put:
ConsoleHelper.writeMessage(res.getString("success.format"));
insttead of :
String output = String.format(res.getString
("success.format"), Integer.parseInt(numbers[0]), currencyCode);
ConsoleHelper.writeMessage(output);
I know it's not right, but it worked
in the main method you get the operation from the console and you execute the login command. You forgot to execute the chosen operation after:
operation = ConsoleHelper.requestOperation();
CommandExecutor.execute(Operation.LOGIN);
CommandExecutor.execute(operation);