C++ programming analyze each problem, develop a solution
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.
We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.