Define and implement a default constructor for robot class

Assignment Help C/C++ Programming
Reference no: EM13783404

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.

Reference no: EM13783404

Questions Cloud

Distinctive competence and core competence of hyundai : Distinctive competence and core competence of Hyundai. How have the values and mission statement helped shape the planning. What are some internal and external factors that may influence the business in the future and explain how they will influen..
Describe the history and evolution of health care economics : Describe the history and evolution of health care economics and the timeline of health care funding, using the defined terms. Include two outside resources.
Explain what is the legal definition for sexual harassment : What is the legal definition for sexual harassment? What investigation process should 1995 Auto Corp. have engaged in when the claims were first made? Why will that be important to the defense of the EEOC charge
Project from your place of employment : In this assignment, you will select a program, quality improvement initiative, or other project from your place of employment (I WORK IN ICU). Assume you are presenting this program to the board for approval of funding. Write an executive summary ..
Define and implement a default constructor for robot class : 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)
Write a two page paper on buying vs renting a home : Write a two page paper on buying vs renting a home.
Physical and mental health of individuals : Generate a chart that demonstrates how the sociological environment influences the physical and mental health of individuals. Include both the physical and social environment and write a synopsis of the influence created by each item on the chart.
Fix the essay which one is more convince gender and languag : Fix the essay "Which One is More convince GENDER AND LANGUAGE".
Create program to determine the median grade : Modify that program to determine the median grade along with the average and the highest and lowest grades

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c++ program that creates and populate a tree

Write a C++ program that creates and populate a tree for an arithmetic expression. Then it should perform an in-order and a post-order traversal on the tree.

  Question 1the figure given is an example of select onea

question 1the figure given is an example of select onea. class adapter pattern b. observer pattern c. composite

  Write a full program that implements the aggregation concept

Write a full program that implements the aggregation concept for the Mail Message, Header , Body and Attachment classes.

  Public data members and private data members.

Explain the difference between public data members and private data members. Give an example in the main function to show that one C++ statement is valid and the other is invalid (you can use Grade class in Problem 5.

  Atm system code two classes with related attributes

Related to ATM system code two classes with realted attributes and operations!in C++

  Basic game of battleship

Basic Game of Battleship - Analyze a basic set of requirements and apply top-down design principles for a problem and eliminate redundancy within a program by applying loops and functions

  Write a printf or scanf statement

Write a printf or scanf statement for each of the following:a. Print unsigned integer 40000 left justified in a 15-digit field with 8 digits.b. Read a hexadecimal value into variable hex.

  Sum of two squares of natural numbers

The formula "x is a sum of two squares of natural numbers" can be written as ?y?z(x = y × y + z × z).

  Write a method that returns the number of digits

Write a method that returns the number of digits in an integer argument; for example, 23,498 has five digits.

  Calculates an employees wage for a week

Write a program that calculates an employee's wage for a week. An employee's wage is calculated as follows - if the number of hours is less than or equal to 40, then the total payment is hour rate

  Create two arrays with ten random numbers

Determine the largest difference (only subtract corresponding index numbers) between these two arrays. (hint: create a third array with the differences)

  Write a program that sorts a linked list

Write a program that sorts a linked list of integers using merge sort. the program will read the integers froma file onto a linked list and then sort the linked list using MERGE SORT. this will require additional linked lists but you should use li..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd