Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Programming: Thank you for your help. Code: https://drive.google.com/file/d/1Je1twmWmbinw8Xl7UGJYVV6199WxQ5e4/view?usp=sharing JAVA PROGRAMMING Complete the Robot.java class as specified in the assignment description. Use the Stacklat interface,
Java Programming: Thank you for your help.
Code: https://drive.google.com/file/d/1Je1twmWmbinw8Xl7UGJYVV6199WxQ5e4/view?usp=sharing
JAVA PROGRAMMING Complete the Robot.java class as specified in the assignment description. Use the Stacklat interface, as well as the inkedStack class to develop your solution. You can use the RobotTest.java, robot0.txt, and robotl.txt files for basic testing robot0.txt Your task is to simulate a "blocks world in which a robot arm performs tasks involving the manipulation of blocks under certain constraints. Your program will act as a robotic arm that responds to a limited set of commands that instructs the robot arm in how to manipulate blocks that lie on a flat table. Blocks are labeled with lowercase alphabetic characters and arranged in three piles, as showna in the figure. move a over c move f over b pile over e discard a You are to write the Robot class, which will have the following public methods (of course, you may need additional helper methods to aid in implementing the required methods): robot1.txt Robot (String blocka): a constructor that initializes the robot's world. The string argument contains characters representing the blocks in each of the three piles, separated by commas. For each pile, the block at the bottom of the pile is listed first. For instance, the world in the figure above would be represented by the string "a, dcb, fe" as an argument to the constructor. move a over c discard pile b over e discard c boolean readActions (String filename) : a method to read and process commands for the robot to perform. The valid commands for the robot arm are: move XoverY: where X and Y are block labels, puts block X onto the top of the pile containing block Y. Any blocks that are stacked on top of block X should be restored to their original pile in their original order pile Xover Y: where Xand Y are block labels, puts the pile of blocks consisting of block X, and any blocks that are stacked above X, onto the top of the pile containing block Y. The blocks . stacked above block X retain their order when moved. discard X: remove block X from its pile and restore other blocks in their original order e quit in such an action). The method returns true if the file is opened and processed successfully String toString: retum a properly formatted string with the contents of the three piles, one per line. For each pile, the block at the top should be listed first. Your class should be stored in a file named Robot Java and should be tested using the RobotTest.java class and text files provided by the instructor. In addition, use the StackInt.java and LinkedStack.java files provided. Any stack must be dedlared as follows: StackInt Type> myStack-ne LinkedStackO When finished, submit Robot.java to Mimir for testing. Do not submit RobotTest.java. StackInt.iava. Sample input file contents: movea Over c nore f over b Sample toString value: Bile 1: https://drive.google.com/file/d/1JeltwmWmbinw8XI7UGJYVV6199WxO5e4/view? sh JAVA PROGRAMMING Complete the Robot.java class as specified in the assignment description. Use the Stacklat interface, as well as the inkedStack class to develop your solution. You can use the RobotTest.java, robot0.txt, and robotl.txt files for basic testing robot0.txt Your task is to simulate a "blocks world in which a robot arm performs tasks involving the manipulation of blocks under certain constraints. Your program will act as a robotic arm that responds to a limited set of commands that instructs the robot arm in how to manipulate blocks that lie on a flat table. Blocks are labeled with lowercase alphabetic characters and arranged in three piles, as showna in the figure. move a over c move f over b pile over e discard a You are to write the Robot class, which will have the following public methods (of course, you may need additional helper methods to aid in implementing the required methods): robot1.txt Robot (String blocka): a constructor that initializes the robot's world. The string argument contains characters representing the blocks in each of the three piles, separated by commas. For each pile, the block at the bottom of the pile is listed first. For instance, the world in the figure above would be represented by the string "a, dcb, fe" as an argument to the constructor. move a over c discard pile b over e discard c boolean readActions (String filename) : a method to read and process commands for the robot to perform. The valid commands for the robot arm are: move XoverY: where X and Y are block labels, puts block X onto the top of the pile containing block Y. Any blocks that are stacked on top of block X should be restored to their original pile in their original order pile Xover Y: where Xand Y are block labels, puts the pile of blocks consisting of block X, and any blocks that are stacked above X, onto the top of the pile containing block Y. The blocks . stacked above block X retain their order when moved. discard X: remove block X from its pile and restore other blocks in their original order e quit in such an action). The method returns true if the file is opened and processed successfully String toString: retum a properly formatted string with the contents of the three piles, one per line. For each pile, the block at the top should be listed first. Your class should be stored in a file named Robot Java and should be tested using the RobotTest.java class and text files provided by the instructor. In addition, use the StackInt.java and LinkedStack.java files provided. Any stack must be dedlared as follows: StackInt Type> myStack-ne LinkedStackO When finished, submit Robot.java to Mimir for testing. Do not submit RobotTest.java. StackInt.iava. Sample input file contents: movea Over c nore f over b Sample toString value: Bile 1: https://drive.google.com/file/d/1JeltwmWmbinw8XI7UGJYVV6199WxO5e4/view? sh
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started