autoshowtester.java

来自「Java array and inheritance examples」· Java 代码 · 共 40 行

JAVA
40
字号
public class AutoshowTester { 
public static void main(String args[]) {
    Autoshow  anAutoshow = new Autoshow(); 
    //First add lotsa cars to the show
    anAutoshow.addCar(new Car("959", "Porsche", "red", 340));
    anAutoshow.addCar(new Car("Grand-Am", "Pontiac", "White", 160));
    anAutoshow.addCar(new Car("Mustang", "Ford", "White", 230));
    anAutoshow.addCar(new Car("Rabbit", "Volkswagon", "Blue", 100));
    anAutoshow.addCar(new Car("Jetta", "Volkswagon", "Silver", 130));
    anAutoshow.addCar(new Car("Storm", "Geo", "Yellow", 140));
    anAutoshow.addCar(new Car("MR2", "Toyota", "Black", 210));
    anAutoshow.addCar(new Car("Escort", "Ford", "Yellow", 10));
    anAutoshow.addCar(new Car("Civic", "Honda", "Black", 180));
    anAutoshow.addCar(new Car("Altima", "Nissan", "Silver", 190));
    anAutoshow.addCar(new Car("525", "BMW", "Gold", 490));
    anAutoshow.addCar(new Car("Prelude", "Honda", "White", 90));
    anAutoshow.addCar(new Car("RX7", "Mazda", "Red", 220));
    anAutoshow.addCar(new Car("MX6", "Mazda", "Green", 180));
    anAutoshow.addCar(new Car("Firebird", "Pontiac", "Black", 140));

    //Now test our fun methods
    System.out.println(anAutoshow);
    System.out.println("\nHere are the Pontiac cars:");
    System.out.println(anAutoshow.carsWithMake("Pontiac"));
    System.out.println("Here are the Ford cars:");
    System.out.println(anAutoshow.carsWithMake("Ford"));
    System.out.println("\nHere are the different makes:");
    System.out.println(anAutoshow.differentMakes());
    System.out.println("\nThis is the fastest car:");
    System.out.println(anAutoshow.fastestCar());
    System.out.println("\nThe most common color is " +
        anAutoshow.mostCommonColor());
    System.out.println("\nHere are the cars sorted by top speed:");
    anAutoshow.printBySpeed();
    System.out.println("\nHere are the cars sorted by make:");
    anAutoshow.printByMake();
}

} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?