Details of this Paper

C++ programming Analyze each problem, develop a solution

Description

solution


Question

Using C++ programming: Analyze each problem, develop a solution and implement your solution. Copy and paste your program and a sample output below each problem.;Define the class Robot. This class must have two integer type private data members locationX and locationY and a Boolean variable load.;a. Define and implement a default constructor for the Robot class that sets the locations to zero, and load to false (no load is being carried by the Robot);b. Overload the constructor ? define and implement a second constructor function that receives three parameters to set the locations and the load for the Robot.;c. Define four public methods goLeft(), goRight(), goUp(), goDown() with void return type and no parameters. These methods (member functions) move the robot one unit in the requested direction. Should these methods be declared as const?;d. Define and implement a public method (member function) that returns the distance of the robot from the origin. The distance of the point (x, y) from the origin is given by the formula. Think about the parameters the method should receive (if any) and the return type.;e. Define and implement the public method goToOrigin() that moves the Robot one unit at a time back to the (0, 0) location, this method can use goLeft(), goRight(), ? methods to move the Robot.;f. Define and implement the public method goToLocation(int xc, int yc) that moves the Robot one unit at a time to the location (xc, xy), this method can use goLeft(), goRight(), ? methods to move the Robot.;g. Define and implement the public methods pickUpLoad() and dropLoad(), the first method sets the load variable to true, meaning the robot has a load and the second function sets it to false, meaning the no load is on the Robot.;h. Define and implement accessor/get functions getX(), getY() and getLoad() that return the x and y coordinates of the location as well as the value of the load variable (true[1] or false[0]).;i. Write a main function in which a Robot is instantiated (created), and then prompt the user to enter the x and y coordinates of some load, say a box, for the Robot to go pick up. The user should also enter the x and y location of destination where the box should be dropped. Your programs should steer he Robot to the location of the box, pick up the box a then drop off the box at the destination location.

 

Paper#64200 | Written in 18-Jul-2015

Price : $32
SiteLock