Forums Register Login

Help

+Pie Number of slices to send: Send
I have to use a helper functions in the driver class with main to help with the driving. The paterrn for the Test drive is the following.
public class TestDrivable
{
public static final int LEFT = 0;
public static final int RIGHT = 1;
public static goForward(Drivable vechicle)
{
vechicle.accelerate();
vehicle.decelearate();
}
public static turn(Drivable vehicle, int direction)
{
vehicle.decelerate();
vehicle.turn(direction);
vehicle.accelerate();
}
public static void main(String [] args)
{
Van mini = new Van;

I have no idea what this mean can you help me clarify on what i should do to make this whole thing work
+Pie Number of slices to send: Send

Start by making a Van class that defines the methods you are calling: accelerate(), decelerate(), and turn( direction ). If Drivable is an interface, Van needs to implement Drivable. If Drivable is an abstract class, Van needs to extend Drivable. You cannot call methods you do not have defined, and you cannot create a Van without defining what a Van is.
This is awkward. I've grown a second evil head. I'm going to need a machete and a tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 893 times.
Similar Threads
help
using interface and how to implement them
enums
Interface
Return
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 21:58:02.