Instructions for Project Two, Wandering Robot Copyright 2021, Dallas College. All Rights reserved. Page 1 of 2 Wandering Robot Write a C++ program that simulates the action of a defective robot that...

1 answer below »
Write a C++ program that simulates the action of a defective robot that wanders from floor to floor in a twenty-three-story building. After simulating the motion of the robot, your program will display a bar chart showing the number of times the robot stayed on each floor of the building.


Instructions for Project Two, Wandering Robot Copyright 2021, Dallas College. All Rights reserved. Page 1 of 2 Wandering Robot Write a C++ program that simulates the action of a defective robot that wanders from floor to floor in a twenty-three-story building. After simulating the motion of the robot, your program will display a bar chart showing the number of times the robot stayed on each floor of the building. When you arrive on the scene to begin studying the robot, it is on the eleventh floor of a twenty-three-story building. Every five minutes the robot either moves up one floor or down one floor. There is the same chance that the robot will move up as move down, it is totally random. Keep track of the number of times the robot stays on each of the twenty-three floors and display that information as a bar chart using a character like an asterisk (*) to represent each time the robot has stayed on a particular floor. For example, our robot starts on the eleventh floor and moves up to the twelfth floor, five minutes later it moves up to the thirteenth floor and after another five minutes it moves back down to the twelfth floor. A portion of a bar chart showing the number of times the robot stayed on each floor would look like this: Floor Number of Visits ----- ----------------------- 14 13 * 12 ** 11 * 10 This is only a portion of the output your program will produce. Your Bar Chart will include all 23 floors from 1 through 23. Your output will display the top floor (23) at the top and the bottom floor (1) at the bottom to properly represent the floors in the building. Observe the robot’s behavior for a number of hours that is entered by your user. Do not forget to validate your user’s input. Valid entries range from zero (0) to twelve (12). Your bar chart will show how many times the robot stayed on each floor. NOTES: • The robot cannot go above the twenty-third floor or below the first floor, the ground floor. • Your user cannot observe for more than twelve (12) hours. • The robot can only go up or down one floor at a time. After prompting your user for the number of hours, which can be a floating- point value, display the number of 5-minute intervals that will be observed. Copyright 2021, Dallas College. All Rights reserved. Page 2 of 2 This assignment allows you to use an array, generate random numbers, interact with your user, validate input, control processing with repetition structures, and format output. To receive full credit for this assignment: • Use the correct naming convention for the file you submit. • Submit a program that executes correctly. • Include meaningful comments. Suggested grading criteria: • Include a comment that contains your full name (10 points) • Include additional meaningful comments (5 points) • Use an array to correctly keep track of the number of visits (20 points) • Validate the user’s input (10 points) • Display the correct number of 5-minute intervals that will be observed. (10 points) • Display a bar chart showing the number of times the robot stayed on each of the 23 floors of the building. (25 points) • Provide clear and easy to follow directions. (10 points) • Use a repetition structure like a “for” loop. (10 points) Example output: How many hours do you wish to observe the robot: 10.5 You will get to see 126 robot movements. Floor Number of Visits ----- --------------------------- 23 22 21 20 19 18 **** 17 ****** 16 ********** 15 *************** 14 ********************* 13 *********************** 12 ********************** 11 **************** 10 ******* 9 ** 8 * 7 6 5 4 3 2 1
Answered Same DayOct 27, 2021

Answer To: Instructions for Project Two, Wandering Robot Copyright 2021, Dallas College. All Rights reserved....

Vibhav answered on Oct 28 2021
123 Votes
Robot/1.JPG
Robot/robot.cpp
Robot/robot.cpp
// #include
// #include
// #incl
ude
// #include
// using namespace std;
// int main(){
//     int floors[23];     //Floors from 0 to 22
//     for(int i=0; i<23; i++)
//         floors[i] = 0;
//     int current_floor = 11;
//     floors[current_floor-1]++;
//     float hours;
//     int intervals;
//     do{
//         cout<<"Enter number of hours to observe: ";
//         cin>>hours;
//         if (hours>=0 && hours<=12)
//             break;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here