Driver4 - Car cars = {first, second, third, fourth, fifth};...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Driver4 { public static void main(String[] args) { // Create some cars Car first = new Car(4, 25000, 2010, "Nissan", "Altima"); Car second = new Car(4, 78000, 2008, "Ford", "Taurus"); Car third = new Car(2, 5000, 2010, "Honda", "S2000"); Car fourth = new Car(2, 3000, 2006, "Porsche", "Carrera GT"); Car fifth = new Car(4, 220000, 1999, "Saturn", "SL2"); // create an array
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Car cars = {first, second, third, fourth, fifth}; // Create a garage Garage garage = new Garage(cars); // print info garage.printGarageInfo(); // create another car and try to add it Car sixth = new Car(2, 58000, 2006, "Dodge", "Viper"); garage.addCar(sixth); // try to remove car at index 3 garage.removeCar(3); // then at index 4; garage.removeCar(4); } }...
View Full Document

Ask a homework question - tutors are online