Vehicle Driver Class using New Constructors

 

/**
* @author cdodge
* 1-18-2018 - Driver class used to test the Vehicle class.
*/
public class VehicleDriver {

/**
* Variables go here
*/
public static void main(String[] args) {
// Main method
// Create two new vehicle objects
Vehicle car1 = new Vehicle();
Vehicle car2 = new Vehicle();
Vehicle car3 = new Vehicle("Ford", 23);
Vehicle car4 = new Vehicle( 45, "Honda" );

car1.setMake("Dodge");
car1.setMilesPerGallon(12);

car2.setMake("Prius");
car2.setMilesPerGallon(40);

//System.out.println(car1);
System.out.println("Your car is a " + car1.getMake() + " and it gets " + car1.getMilesPerGallon() + " miles per gallon" );
System.out.println("Your other car is a " + car2.getMake() + " and it gets " + car2.getMilesPerGallon() + " miles per gallon" );
System.out.println("Your car is a " + car3.getMake() + " and it gets " + car3.getMilesPerGallon() + " miles per gallon" );
System.out.println("Your car is a " + car4.getMake() + " and it gets " + car4.getMilesPerGallon() + " miles per gallon" );
}

}