/******************************************************************************* * Třída Demo k demonstraci práce s dalšími třídami v projektu * * @author Tomáš Pitner * @version 1.00, 10.8.2005 */ public class Demo { private static final Person jd = new Person("Jan Dvorak", 23); private static final Person lm = new Person("Libor Malina", 40); private static final Person js = new Person("Jan Samek", 20); private static final Person jn = new Person("Jan Novak", 44); private static final Person ln = new Person("Lukas Novotny", 21); public static void main(String[] args) { getOnAndList(); throwDemo(); } public static void getOnAndList() { PrivateCar c = new PrivateCar("BKE 20-57", 5); try { c.getOn(jd); c.getOn(lm); c.getOn(js); c.getOn(jn); c.getOn(ln); } catch (NotEnoughSeatsException nese) { System.out.println(nese.getMessage()); } c.listCrew(); } protected static void throwDemo() { try { getOnGetOffDemo(); } catch(NotEnoughSeatsException nese) { System.out.println("Not enough seats exception occured: " + nese); } catch(CarException ce) { System.out.println("Some other CarException occured: " + ce); } } protected static void getOnGetOffDemo() throws CarException { PrivateCar c = new PrivateCar("BKD 21-50", 3); c.getOn(jd); c.getOff(ln); } }