aspose file tools*
The moose likes Beginning Java and the fly likes Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help" Watch "Help" New topic
Author

Help

Duc Nguy
Greenhorn

Joined: Nov 12, 2001
Posts: 7
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

Joined: Jul 22, 2000
Posts: 9046
    
  10

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.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help