Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program To design flow diagram form. This diagram should help you identify the sequence of steps needed to solve specific situations that the robot

C++ program

To design flow diagram form. This diagram should help you identify the sequence of steps needed to solve specific situations that the robot will encounter. Be specific. Break down the actions into small steps.

------------------------------------------------------------------------ // // // // // // Functions for the seven robot operations // // // // // // ------------------------------------------------------------------------ // // // Function get_block // Reads in a single character value from the keyboard // This is the input from the chute // Returns: a single character // // Example function call: block = get_block(); char get_block(void) { char block; cin >> block; return block; } // Function put_block // This function stores a character into the character array representing the slots // // Inputs: // block - type char - The character to be inerted into a slot // position - type unsigned int - index of the slot where the block will go // array - type char - array of slots containing the blocks // // Returns: // position - type unsigned int - the index of the slot where the block was placed // // Example function call: put_block(block, position, slots); unsigned int put_block(char block, unsigned int position, char array[]) { array[position] = block; cout  

image text in transcribedimage text in transcribedimage text in transcribed image text in transcribed

write a program using the basic robot operations stated below Get Block-Removes and holds one block from the chute Put Block- Inserts the block currently held by the robot into an empty slot. Switch Blocks -Removes a block currently in a slot and replaces it with the block being held by the robot. When finished the robot is holding the block it just removed from the slot. Compare Blocks-Compares the value of the block (letter) being held by the robot to that of a block in a slot. (If the block held by the robot is less than or equal to the block in the slot the result of the compare is TRUE. If the block held by the robot is greater than the block in the slot the result of the compare is FALSE) a. b. c. d. e. Shift Left -Shift the robotic arm one slot to the left. (Cannot go to the left of slot 1) f. Shift Right - Shift the robotic arm one slot to the right. (Cannot go to the right of slot 20) g. Test Empty Determines if a slot is empty. (Returns True if empty or False if the slot contains a block.) Included with the robot are functions for each of the above operations coded in the C++ Programming Language. The code may be downloaded from the assignments tab in Canvas. You will need to write another function that will print out the contents of all 20 slots in order to see how the block placement progresses and to show the final arrangement. To test your robot write a program that will place a series of blocks into 20 slots in alphabetic order Specifically the robot must be able to accomplish this task according to the following requirements: To begin with all slots must be empty The robot must be able to start at any of the 20 slots. (Specified at program start.) Blocks will enter the chute in random order. Blocks entering the chute will have a value from Athrough 'Z'. (Uppercase alphabetic characters.) Blocks may repeat. (e.g. there may be two or more blocks with the same letter value.) The robot can take only one block from the chute at a time. The robot can switch the block it is holding with a block in a given slot. The robot can only shift (left or right) one slot at a time. (If you want to shift more than one position you will need to use a loop.) As blocks are placed into the slots they must be in alphabetic order. (You are not allowed to randomly place all the blocks and then sort them) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. The robot cannot go to the left of slot 1 or to the right of slot 20. (This means that you will have to allow for movement of multiple blocks to the left or right in order to stay within the 20 slots.) write a program using the basic robot operations stated below Get Block-Removes and holds one block from the chute Put Block- Inserts the block currently held by the robot into an empty slot. Switch Blocks -Removes a block currently in a slot and replaces it with the block being held by the robot. When finished the robot is holding the block it just removed from the slot. Compare Blocks-Compares the value of the block (letter) being held by the robot to that of a block in a slot. (If the block held by the robot is less than or equal to the block in the slot the result of the compare is TRUE. If the block held by the robot is greater than the block in the slot the result of the compare is FALSE) a. b. c. d. e. Shift Left -Shift the robotic arm one slot to the left. (Cannot go to the left of slot 1) f. Shift Right - Shift the robotic arm one slot to the right. (Cannot go to the right of slot 20) g. Test Empty Determines if a slot is empty. (Returns True if empty or False if the slot contains a block.) Included with the robot are functions for each of the above operations coded in the C++ Programming Language. The code may be downloaded from the assignments tab in Canvas. You will need to write another function that will print out the contents of all 20 slots in order to see how the block placement progresses and to show the final arrangement. To test your robot write a program that will place a series of blocks into 20 slots in alphabetic order Specifically the robot must be able to accomplish this task according to the following requirements: To begin with all slots must be empty The robot must be able to start at any of the 20 slots. (Specified at program start.) Blocks will enter the chute in random order. Blocks entering the chute will have a value from Athrough 'Z'. (Uppercase alphabetic characters.) Blocks may repeat. (e.g. there may be two or more blocks with the same letter value.) The robot can take only one block from the chute at a time. The robot can switch the block it is holding with a block in a given slot. The robot can only shift (left or right) one slot at a time. (If you want to shift more than one position you will need to use a loop.) As blocks are placed into the slots they must be in alphabetic order. (You are not allowed to randomly place all the blocks and then sort them) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. The robot cannot go to the left of slot 1 or to the right of slot 20. (This means that you will have to allow for movement of multiple blocks to the left or right in order to stay within the 20 slots.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions