/*
* Car.java
*
* Created on March 11, 2008, 8:20 PM
*
* To keep accurate account of our cars.
*/
/**
*
* @author dfreer
*/
public class Car {
boolean start = false;
String engine = "";
String brake = "";
private String name = "Herbie";
/** Creates a new instance of Car */
public Car(String eng, String br, String n) {
//constructor
engine = eng;
brake = br;
name = n;
}
public String getEngine()
{
return engine;
}
public void changeEngine(String ch)
{
engine = ch;
}
public boolean startEngine()
{
start = true;
return start;
}
public String getName(){
return name;
}
public static void main(String [] args)
{
Car herbie = new Car("3.8L", "moderate", "George");
System.out.println(herbie.getEngine());
herbie.changeEngine("V8");
System.out.println(herbie.getEngine()+ " is the engine of the new and improved " + herbie.getName());
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment