FIND A SOLUTION AT Academic Writers Bay
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 exle “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.
Note: When you want to print out the contents of a KivaCommand array variable called commands, for exle, you would call Arrays.toString(commands) to turn the array into a single String. You’ll need to import java.util.Arrays to use this method. Here is some sle code that you can play with in BlueJ to demonstrate this, then use the approach for your needs:
- WE OFFER THE BEST CUSTOM PAPER WRITING SERVICES. WE HAVE DONE THIS QUESTION BEFORE, WE CAN ALSO DO IT FOR YOU.
- Assignment status: Already Solved By Our Experts
- (USA, AUS, UK ; CA PhD. Writers)
- CLICK HERE TO GET A PROFESSIONAL WRITER TO WORK ON THIS PAPER AND OTHER SIMILAR PAPERS, GET A NON PLAGIARIZED PAPER FROM OUR EXPERTS
QUALITY: ORIGINAL PAPER – NO PLAGIARISM - CUSTOM PAPER
- non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How It Works
- Click on the “Place Your Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT ; SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.
AcademicWritersBay.comnbsp;is an easy-to-use and reliable service that is ready to assist you with your papers 24/7/ 365days a year. 99% of our customers are happy with their papers. Our team is efficient and will always tackle your essay needs comprehensively assuring you of excellent results. Feel free to ask them anything concerning your essay demands or Order.
AcademicWritersBay.com is a private company that offers academic support and assistance to students at all levels. Our mission is to provide proficient andnbsp;high quality academic servicesnbsp;to our highly esteemed clients. AcademicWritersBay.com is equipped with competent andnbsp;proficient writersnbsp;to tackle all types of your academic needs, and provide you with excellent results. Most of our writers are holders ofnbsp;master's degreesnbsp;ornbsp;PhDs, which is an surety of excellent results to our clients. We provide assistance to students all over the world.
We provide high quality term papers, research papers, essays, proposals, theses and many others. Atnbsp;AcademicWritersBay.com, you can be sure ofnbsp;excellent gradesnbsp;in your assignments and final exams.