Question: Please write the codes CLEARLY by (C++) this is the question: and this is the given source code walking.cpp and here is the output should


























Study the given source code walking.cpp and use the given struct and the following ten classes, which represent ten different scenes: In this problem, you will represent a race between a man and a woman. You will use random number generation to develop a simulation of this race. Our contenders begin the race at "square 1". Each square represents a possible position along the racecourse. The race finishes after 100 iterations. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your script should adjust the position of the contenders according to the following rules: In this problem, you will represent a race between a man and a woman. You will use random number generation to develop a simulation of this race. Our contenders begin the race at "square 1". Each square represents a possible position along the racecourse. The race finishes after 100 iterations. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your script should adjust the position of the contenders according to the following rules: Start each contender at position (10,5) (i.c., the "starting gate"). If a contender slip left before square 10, move the contender back to square 10 . Generate the percentages in the preceding table by producing a random integer i in the range 1 to 10. For the man, perform a "fast plod" when i is 1,2,3,4, or 5 ; a "slip" when i is 6 or 7 ; and a "slow plod" when i is 8,9 , or 10 . For the woman, perform a "sleep" when / is 1 or 2 ; a "big bop" when i is 3 or 4 ; a "big slip" when i is 5 ; a "small hop" when i is 6,7 , or 8 ; and a "small slip" when i is 9 or 10 . For each tick of the clock (i.e., each repetition of a loop), print T in the position of the turtle and R in the position of the rabbit. Hinclude \#include y Coord =5; int start =10, stepN = start, steph = starty double radius=2.5, neck =2.5, body =6, foot=1.5; double leftArme3, leftForearme3, rightAre=3, rightForearme3; double leftThigh=3.5, leftLege3.5, rightThighe3.5, rightlege3.5; struct point i Jcenter, double xCoordinate, yCoordinate; void gotoxy(double, double); void clrscr(); void line(point, point); void circle(point, double); int manstep(); int womanStep(); class shape t public: virtual void draw() const = 0; class sceneHt: public shape t public: void draw() const; 3 class scenei2: public shape f public: void draw() const; 35 class sceneVB: public shape t public: class sceneWi: public shape t publict vold draw() consty Js cless sceneM4 public shape t publict void draw() consty 13 cless sceneust public shape t publict l; 35 cless scenelit: public shape t publict void draw() const; 3; class sceneV2: public shape public: void draw() const; \}; class sceneM3: public shape t public: void draw() const; \}; class scenck4: public shape t public: void draw() const; class sceneW5: public shape f public: void drew () const; 3; int main() if (stepM > stepw) cout "Yeach, the man win" endl; cout "Yaasaaaaah, the woman wins" endl; return 0 ; 11 Left Foreare p=q;qxCoordinate=pxCoordinate*6;qyCoordinate=pyCoordinate2.51ine(p,q); 11 Right Arm p=teeppqxCoordinate=pxcoordinate2.5;qyCoordinate=pyCoordinate3.5;line(p,q); If Right Forearim p=q;qxCoordinate=pxCoordinatet4;qyCoordinate=pyCoordinate;line(p,q); 1/ Body p=teep;qxCoordinate=center,xCoordinate;qyCoordinate=center,yCoordinate14;line(p,q); 11LeftThightenp=p=q;qxcoordinate=pxCoordinate3;qycoordinate=pyCoordinate3.5;line(p,q); 1f Left Leg p=q;qxCoordinate=pxCoordinate-3;qyCoordinate=pyCoordinate3.5;line(p,q); /I Left Foot p=q;qxCoordinate=pxCoordinate+2.5;qyCoordinate=pyCoordinate1;line(p,q); If Right Thigh p=teap;qxCoordinate=pxCoordinatet5;qycoordinate=pyCoordinatet2;line(p,q); Right Leg 11 Right Are p=teep;qxCoordinate=pxCoordinate2;qyCoordinate=pyCoordinatet4;line(p,q); 11 Right Foreare p=q;qxCoordinate=pxCoordinate5;qyCoordinate=pyCoordinate-1.5;line(p,q); 11 Body p= tenp; qx Coordinate = center-xCoordinate; qy Coordinate = center-yCoordinate 14; line (p,q); Thigh temp =p=q; qx Coordinate =px Coordinate 2.5; qycoordinate=py Coordinate*4; line (p,q); 1/ Left Thigh Left Arm temp=p=q;qxCoordinate=pxCoordinate2}qycoordinate=pyCoordinate3.5}line(p,q); 11 Left Foreari p=q;qxCoordinate=pxCoordinate4;qyCoordinate=pyCoordinate3;line(p,q); 11 Right Arim p=tenp;qxCoordinate=pxCoordinatet2;qyCoordinate=pyCoordinatet4.5;line(p,q); 11 Right Foreare p=q;qxCoordinate=p-xCoordinate6;qyCoordinate=p-yCoordinate2;line(p,q); If Right Thigh Right Thigh p= temp qx Coordinate =p,x Coordinate 3,5j qyCoordinate=pyCoondinate3,5 1 ine (p,q); 11 Right Leg p=q;qxCoondinate=pxCoordinate3;qyCoordinate=pyCoordinate3;line(p,q); 11 Right Foot 11 Left Are tewp=p=q;qxCoordinate=pxCoordinate-3.5;qyCoordinate=pyCoordinate+3.5;line(p,q); 11 Left Foreare p=q;qxCoordinate=pxCoordinate2.5;qyCoordinate=pyCoordinate2.5; line(p,q); I/ Right Are p=teap;qxCoordinate=p.xCoordinate+2.5;qyCoordinate=p.yCoordinatet3.5;linalnal. I/ Body 1/ Right Leg I/ Right Leg p=q;qxCoordinate=pxCoordinate2;qyCoordinate=pyCoordinatet3.5;line(p,q); I/ Right Foot I/ Body 1/ Right Leg I/ Body p=temp;q.xCoondinate=center,xCoordinatet4;q.yCoordinate=center.yCoordinate-14;line(p,q);q.xCoordinate=center.xCoondinate-4;line(p,q);p=q;q.xCoordinate=center..xCoordinatet4sline(p,q);q.xCoordinate=center.xCoordinate-2; Left Thigh terp =p=q; qxCoordinate=p.xCoordinate+1.5; q.yCoordinate=p.y Coordinatet4; line (p,q); 11 Left Leg p=q;qx;oordinate=p.xCoordinate-2;q.yCordinate=p.yCoordinatet4.5;line(p,q); // Left Foot p=q;qxC;oordinate=pxCoordinate+2.5;qyCoordinate=p.yCoordinate+1;line(p,q); I/ Right Thigh p=teep;q.xCoordinate=pxCoordinate+3.5;q.yCoordinate=p.yCoordinate+3.5; line((p,q); // Right Leg p=q;qxCoordinate=pxCoordinate-3;qycoordinate=pyCoordinate+3;line(p,q); 1/ Right Foot q.xCoordinate =px Coordinate+2.5; p=q; q.yCoordinate =p.yCoordinate+1; line (p,q); 3 Left Thigh temp =p=q; qx Coordinate =px Coordinate +1j qy Coordinate =py Coordinate 3.5 line (p,q); Left Leg p=q;qxCoordinate=pxCoordinate-3.5;qyCoordinate=pyCoordinate4.5;line(p,q); Left Foot p=q;qxCoordinate=pxCoordinate2.5;qyCoordinate=pyCoordinate1;1ine(p,q); If Right Thigh p=temp;qxCoordinate=pxCoordinate5;qyCoordinate=pyCoordinate4; line(p,q); 11 Right Leg p=q;qxCoordinate=pxCoordinate-3.5;qyCoordinate=pyCoordinate+4.5;line(p,q); 1/ Right Foot q.yCoordinate = p.ycoordinatet1j line (p,q); 3 void scenek5: zdraw() const t 11 Head center,xCoordinate=stepW;center.yCoordinate=yCoord;circle(center,radius); 11 Neck p.xCoordinate = center x Coordinate; p.ycoordinate = center,y Coordinate+radius; q.y Coordinate = center.yCoordinate+radiustnecki q.xCoordinate = center.xCoordinate; I/ Neck p.xCoordinate=center.xCoordinate;pyCoordinate=center.yCoordinate+radius;qxCoordinate=center.xCoordinatejqyCoordinate=center.yCoordinatetradiustneck;line(p,q); 1/ Left Arm temp =p=q; qx Coordinate =px Coordinate-2.5; qy Coordinate = p.y Coordinatet3.5; line (p,q); I/ Left Forearm p=q;qxCoordinate=p.xCoordinate+6;qyCoordinate=pyCoordinate+2.5;line(p,q); 1/ Right Arw p=temp;q.xCoordinate=pxCoordinate+2.5;q.yCoordinate=pyCoordinate+3.5; line(p, q); I/ Right Forearm p=q;qx;q0Coordinate=pxCoordinate4d;=p.yCoordinate;line(p,q); I/ Body p=tenp:q.xCoordinate=centerxCoordinate:4;q.yCoordinate=center.yCoordinate+14;line(p,q);q.xCoordinate=center.xCoordinate-4;line(p,q);p=q;q.xCoordinate=center.xCoordinatet4;line(p,q);qxCoordinate=centerxCoordinate-2; I/ Left Thigh temp=p=q; qx Coordinate =px Coordinate 3 ; q. y Coordinate =p.yCoordinate+3.5; line (p,q); 1/ Left Leg p=q;qxCoordinate=pxCoordinate-3;qyCoordinate=pyCoordinate3.5;line(p,q); 1/ Left Foot p=q;qxCoordinate=pxCoordinatet2.55qyCoordinate=pyCCoordinate+1;line(p,q); I/ Right Thigh p=temp;qxCoordinate=pxCoordinate+5;q.yCoordinate=p.yCoordinate+2;line(p,q); I/ Right Leg p=q;qx;oordinate=pxCoordinate-8;q.yCordinate=pyCoordinate2;line(p,q); I/ Right Foot p=q;q.xCoordinate=p.xCoordinate+2.5;q.yCoordinate=p.yCoordinate+1;line(p,q); } void line(point first, point second) t 3 int waenstep() 3 void gotoxy(double x, double y ) f mole hconsolcoutput; conse dicursorposition; cout.flush(); dicursorposition. x=x; dicursorposition. y=y; 3 SetConsolecursorposition(hConsoleoutput, dwcursorposition); void elrser() 1 systen("cls"); climet (ir aftep-manateb15y3res-wamangter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
