Engineering
Engineering, 24.10.2021 14:30, arod20061

Design a class to model a bug moving along a horizontal line on a game board. The bug moves either in the right or left direction. Initially, the bug
moves to the right, but it can turn to change its direction from left to right or
right to left. In each move, its position changes by one unit in the current
direction.
(2 points) Provide the constructor that sets the initial position and
direction(right) of the Bug. (2 points) Design the methods that help the bug to
turn and move. (1 point) Also, write a method to get the current position of the bug.
(2 points) Test the model class by the following steps.
1. Create a bug called bugsy with initial position 10.

2. Move the bugsy.

Now the position is 11
3. Turn the bugsy:

Now the direction is left.
4. Move the bugsy
Now the position is 10

Design the UML class diagram (3 points) and write the code for the above scenario.

answer
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, Candi9697
A-mn has a cubic structure with a0 0.8931 nm and a density of 7.47 g/cm3. b-mn has a different cubic structure, with a0 0.6326 nm and a density of 7.26 g/cm3. the atomic weight of manganese is 54.938 g/mol and the atomic radius is 0.112 nm. determine the percent volume change that would occur if a-mn transforms to b-mn.
Answers: 2
image
Engineering, 04.07.2019 18:10, mirmir62
Machinery that is a key part of the process and without which the plant or process cannot function is classifed as: (clo4) a)-critical machinery b)-essential machinery c)-general purpose machinery d)-none of the specified options.
Answers: 1
image
Engineering, 04.07.2019 18:20, miguel454545
Along 8-cm diameter steam pipe whose external surface temperature is 900c connects two buildings. the pipe is exposed to ambient air at 70c with a wind speed of 50 km/hr blowing across the pipe. determine the heat loss from the pipe per unit length. (b) air at 500c enters a section of a rectangular duct (15 cm x 20 cm) at an average velocity of 7 m/s. if the walls of the duct are maintained at 100c. a) the length of the tube for an exit temperature of the air to be 40 0c. b)the rate of heat transfer from the air. c) the fan power needed to overcome the pressure drop in this section of the duct.
Answers: 1
image
Engineering, 04.07.2019 19:10, nhester3401
Agas is compressed from vi 0.3 m, p 1 bar to of v2 0.1 m3, p2--3 bar. pressure and volume are related linearly during the process. for the gas, find the work, in kj.
Answers: 2
Do you know the correct answer?
Design a class to model a bug moving along a horizontal line on a game board. The bug moves either...

Questions in other subjects: