public void parseLine(String line) { currentLine++; try { Command command = parser.parseCommand(line); switch (command) { case DRIVER: Driver driver = parser.parseDriver(line); tripTracker.registerDriver(driver); break; case TRIP: Trip trip = parser.parseTrip(line); tripTracker.logTrip(trip); break; } } catch (InvalidCommandException e) { System.out.println( "Invalid TripTrackerCommand on line " + currentLine + " of input. " + "Message: " + e.getMessage()); } }
public void displayReport() { System.out.println("=== Trip Tracker Report ===\n" + tripTracker.generateReport()); }