Create a helper method in the remotecontrol class


Problem

Convert User Input to an Array of KivaCommands

The RemoteControl class currently takes in a String of commands from the user that looks like "FFFTRF". However, our Kiva robots cannot understand instructions in that form. They can simply make one move at a time, accepting a single KivaCommand. So, we'll need to take the user inputted commands and convert them into a more Kiva friendly format, a list of KivaCommands that we can send to the robot's move method one at a time.

Write the Convert Method Using continue and/or break

Create a helper method in the RemoteControl class called convertToKivaCommands(). This method should take a String as a parameter, which will be the commands that the user types into the console (for example "FFFTRF"). It should return an array of KivaCommands (in this case FORWARD, FORWARD, FORWARD, TAKE, TURN_RIGHT, FORWARD). We recommend doing this by using the values() method of the KivaCommand enum to get an array of all of the KivaCommands. You can then use the getDirectionKey() method to determine which KivaCommand each char in the String should be converted to. If the user enters a character that does not correspond to a command throw an IllegalArgumentException with a useful error message.

The response must include a reference list. Using Times New Roman 12 pnt font, double-space, one-inch margins, and APA style of writing and citations.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Create a helper method in the remotecontrol class
Reference No:- TGS03142118

Now Priced at $35 (50% Discount)

Recommended (96%)

Rated (4.8/5)