subject

Could someone please answer this In this lab you will develop a class that models a random walk and write two client programs that use the class. A random
walk is basically a sequence of steps in some enclosed space where the direction of each step is random. The walk terminates
either when a maximum number of steps has been taken or a step goes outside of the boundary of the space. Random walks
are used to model physical phenomena such as the motion of molecules and economic phenomena such as stock prices.
We will assume that the random walk takes place on a square grid with the point (0,0) at the center. The boundary of the
square will be a single integer that represents the maximum x and y coordinate for the current position on the square (so for a
boundary value of 10, both the x and y coordinates can vary from -10 to 10, inclusive). Each step will be one unit up, one unit
down, one unit to the left, or one unit to the right. (No diagonal movement.)
The RandomWalk class will have the following instance data (all type int):
• the x coordinate of the current position
• the y coordinate of the current position
• the maximum number of steps in the walk
• the number of steps taken so far in the walk
• the boundary of the square (a positive integer -- the x and y coordinates of the position can vary between plus and
minus this value)

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, jcollings44
You picked the corridor which led you here. if the guards find you, they're going to be really angry! what is the synonym of angry
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, carolelai08
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
image
Computers and Technology, 23.06.2019 19:00, amayax77
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
image
Computers and Technology, 23.06.2019 23:30, huangjianhe135
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
You know the right answer?
Could someone please answer this In this lab you will develop a class that models a random walk and...

Questions in other subjects:

Konu
Chemistry, 04.03.2021 07:10
Konu
Mathematics, 04.03.2021 07:10
Konu
Mathematics, 04.03.2021 07:10
Konu
Mathematics, 04.03.2021 07:10