• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help

 
Duc Nguy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic