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

  Inventory items stored in Sudbury

Give the details of all suppliers in the Sault Ste Marie, list all inventory items with a quantity less than 100 units and list all the inventory items stored in Sudbury

  Written a code that parses through a file reading

written a code that parses through a file reading it line by line and splitting it into tokens by white space. But I want a pair of single quotes to be one token, not how many words are in it

  Value of x after the following code is executed

What will be the value of x after the following code is executed?int x = 20, y = 30;while (y

  Write a function that computes length of a character string

Write a function that computes the length of a character string (i.e. write your own implementation of the strlen function.

  Program to compute and show miles per gallon

Create the program in C++ which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and show miles per gallon.

  Problem related to calculating average in program

Here's the program i must do: 3 evaluators will evaluate 4 parameters ( just name them parameter1, parameter2 ...) the program must ask the evaluators to input those parameters but as letters (N=1,M=2,S=3,B=4,E=5) then I have to do the average for..

  Writing a program that creates a linked list

Writing a program that creates a linked list from 100 randomly generated numbers and sorts the using a heap. One heap in ascending order and one heap in descending order. Then displays the original linked list and both sorted lists.

  Randominrange() function that accepts two integer

Write a randomInRange() function that accepts two integer parameters. The parameters will represent the low number and the high number (both inclusive) in the random range. For example, when the function receives 3 and 8.

  Find the prime numbers

Write a c++ program to find the prime numbers

  C++ pointer function synopsis

C++ pointer Function Synopsis: char *amonthLess(char *dateString) Description: Variable dataString is a valid date in a form of mm/dd/yyyy Given the above information, write a main() program that asks a user to enter a date in a form of mm/dd/yyyy..

  Winning number combinations from the missouri lottery

The file input.txt contains all of the winning number combinations from the Missouri Lottery since it took its current form on January 3, 1998.  The data is in a file called "input.txt"  All of the data in the file is integer.

  Dynamic character arrays

Dynamic character arrays str and add contain strings. Write a function append that uses str and add as arguments and appends add to the end of str. Write a main program that illustrates the use of function append to concatenate five strings.

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