Becker.robots (Robots: Learning to Program with Java) Package Class Package becker.robots Karel the Robot provides a gentle introduction to object-oriented programming via a simple robot which can move, turn left, pick things up, transport them and put them down again. See: Interface Summary A ColoredIcon allows its color to be specified. Construct a new Robot at the given location in the given city with nothing in its backpack. Robot (City aCity, int aStreet, int anAvenue, Direction aDirection, int numThings) Construct a new Robot at the given location in the given city with the given number of things in its backpack. Methods inherited from class becker.robots. A Remote Control Robot, RobotRC for short, can be directed from a computer keyboard. The city's view must have the keyboard focus when the program is running for the robot to receive the instructions from the keyboard. When the city's view has the focus it will have a thin black outline. Provided a3-becker.jar le that you are likely to use to complete this assignment. Note that the only class whose use is absolutely required is Robot (in package becker.robots), although you may nd of other classes useful, such as the Direction enum (also in package becker.robots). Part 1 (0 points): Warm-up. Neram movie mp3 songs download bollywood.
A light is a kind of thing that can be turned on to make it brighter and turned off to make it darker. Some lights can be moved (Flasher
) while others can't (Streetlight
).
The Light
class itself is abstract meaning programmers cannot construct an instance of Light
. It must be extended to create a class that can be instantiated. This class does define a common interface for all lights so that that any light may be turned on or off without knowing what specific kind of light it is (polymorphism).
I have been given the task of writing a segment of code using the becker.robots package and I must create a method called pickUpThings for a class which has a parameter for the number of Things to be picked up ie. Public void pickUpThings(int thingsToBePickedUp).
Constructor Summary |
---|
Light(City aCity, int aStreet, int anAvenue) Construct a new light with the same default appearance as a Thing. |
Light(City aCity, int aStreet, int anAvenue, Direction orientation, boolean canBeMoved, Icon anIcon) Construct a new light. |
Light(Robot heldBy) Construct a new Light held by a robot. |
Method Summary | |
---|---|
boolean | isOn() Determine whether or not the light is turned on. |
void | turnOff() Turn the light off. |
void | turnOn() Turn the light on. |
Methods inherited from class becker.robots.Thing |
---|
blocksIntersectionEntry, blocksIntersectionExit, canBeCarried, getIntersection, save, setBlocksEntry, setBlocksEntry, setBlocksExit, setBlocksExit, setCanBeCarried, toString |
Methods inherited from class becker.robots.Sim |
---|
getCity, getColor, getIcon, keyTyped, notifyObservers, notifyObservers, setColor, setIcon |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
Light
- Construct a new light with the same default appearance as a Thing.
- Parameters:
aCity
- The city in which the light will exist.aStreet
- The light's initial street within the city.anAvenue
- The light's initial avenue within the city.
Light
- Construct a new light.
- Parameters:
aCity
- The city in which the light will exist.aStreet
- The light's initial street within the city.anAvenue
- The light's initial avenue within the city.orientation
- The light's initial orientation. A streetlight, for instance, uses this to determine on which corner of the intersection it appears. One of {Direction
.NORTH, EAST, SOUTH, WEST, NORTHWEST, NORTHEAST, SOUTHWEST, SOUTHEAST}.canBeMoved
- Specifies whether or not the light can be moved by a robot.anIcon
- The icon to use to display this light.
Light
- Construct a new Light held by a robot.
- Parameters:
heldBy
- the robot holding the light.
Method Detail |
---|
turnOn
Becker Robots Methods Definition
- Turn the light on.
Becker Robots Methods Examples
turnOff
- Turn the light off.
Becker Robots Methods Free
Light
- Construct a new Light held by a robot.
- Parameters:
heldBy
- the robot holding the light.
Method Detail |
---|
turnOn
Becker Robots Methods Definition
- Turn the light on.
Becker Robots Methods Examples
turnOff
- Turn the light off.
Becker Robots Methods Free
Becker Robots Methods Cheat
isOn
- Determine whether or not the light is turned on.
- Returns:
- true if the light is on; false otherwise.
Overview | Package | Class | Tree | Deprecated | Index | Help |