/**
* You should have a print method in your
utility class which will print an array of vehicles.
* Make it so that the vehicles appear in a
chart format, with all instance variables displayed.
* BE SURE THAT THE METHODS, THEMSELVES, DO NOT
CALL THE PRINT.
* They should only be called by the methods
below.
*/
/**
* This application program tests the Vehicle
and Dealer classes.
*
* @author Mr. Merlis
* @version
*/
public class MerlisVehicleTest
{
public static void
main (String[] args)
{
Dealer vehicles = new Dealer(); // creates a Dealer object
System.out.println("Number
of trucks: " +
vehicles.numberOfTrucks()); //
display the number of trucks
System.out.println("Number
of convertibles: " +
vehicles.numberOfConvertibles()); // display the number of convertibles
System.out.println("Average
price: " +
vehicles.averagePrice());
// display the
average price
Vehicles v = vehicles.withEfficiency(23); //
returns the first vehicle with an efficiency of "23"
if (v ==
null)
System.out.println("No
vehicle found with an efficiency of 23.");
else
System.out.println(v
+ " was the first found with an efficiency of 23.");
System.out.println("The
least expensive car on the lot costs:
"+ vehicles.findLeastExpensive()); //
print least expensive
System.out.println("The
car with the best efficiency: "+
vehicles.findBestEfficiency()); // print best efficiency
System.out.println("Vehicles
cheaper than 30,000:");
Utility.print(vehicles.findCheaperThan(30000)); //
prints all vehicles < $30,000
String make = "
System.out.println ("\n\nAll the
"+ make + ":");
Utility.print(vehicles.allOfMake(make)); //
prints all vehicles that are
System.out.println("Sorting
by efficiency:");
Utility.print(vehicles.sortByEfficiency()); //
prints all vehicles in order of ascending efficiency
System.out.println("\nLooking
for make/model");
Utility.print(vehicles.findMakeModel("Porsche",
"911 Turbo S"));
System.out.println("\nSorted
by cost");
Utility.print(vehicles.sortByPrice()); //
prints all vehicles in ascending cost order
//vehicles.showInventory();
}
}