-
hey guys, i need help
ok, so i have this assignment dealng with creating classes, but with the instructions i was given i dont even know how to determine what my objects are. if you guys could help me out that'd be great, thanks. here are the instructions:
"The Toys of the Future company has decided to issue a new line of toy robots. While they are not sure exactly what their robots will look like, they do know the functionality that they will all have. All robots will be able to go forward, turn right, turn left, spin and detect an object in front of it via a sensor. The robot will use a touch sensor to determine whether it has hit an object in front of it, such as a wall. The robot will have two, three, or four wheels, but it will only be driven by two of them: a right wheel and a left wheel. Each wheel will be attached to a motor that controls it."
-
Thank of the nouns as classes and the actions or verbs as methods and work from there.
-
-
ok, so here's what i've come up with:
MOVEMENT
-forward
-left
-right
-spin
SENSOR
-object detection
TOUCH SENSOR
-wall detection
WHEELS
-left wheel
-right wheel
so how does this look?
-
You got alot alot of actions there... not a class description ( none that I can see anyway)
-
-
I mean you got a few functions/methods
-
no, like, what do you mean by class descriptions?
-
code that accurately implements a noun i.e. all that the functionality it would expose to a user.
-
MOVEMENT
it would probably ask whether it turns right, left, moves forward, or spins around.
SENSOR
it would ask whether it would detect an object in front of it.
TOUCH SENSOR
it would check to see whether it has bumped into a wall or not.
also, here's the second part:
Now, using the objects and classes that you have written, write a program for your robot that allows it to move in a large square. Allow your robot to run in a big two dimensional array and every time the robot encounters a square in your array, turn that square black.
-
Stop theorizing, get to implementing something.. then come back with questions.
-
thats kinda the whole reason i posted in this forum, because i ddnt know
-
nons
I just meant try something see ho
w far or close u are.u can theorize 2death.
-
Nouns/classes:
- Robot
- TouchSensor
- Wall
- Wheel
- Motor
Verbs/Methods
All the behaviors of the above classes