Exemplo n.º 1
0
 public void drawTrain(Graphics g) {
   loc.drawCar(g);
   tc1.drawCar(g);
   tc2.drawCar(g);
   tc3.drawCar(g);
   cab.drawCar(g);
 }
Exemplo n.º 2
0
 /** Handles train car removal */
 public static void runR() {
   try {
     TrainCar temp = list.removeCursor();
     System.out.println(
         "Car successully unlinked. The following load has been removed from the train:\n"
             + "Name      Weight (t)     Value ($)   Dangerous"
             + "===================================================");
     System.out.println(
         String.format(
             "%-14s%-15s%-12s%-9s",
             temp.getProductLoad().getName(),
             temp.getProductLoad().getWeight(),
             temp.getProductLoad().getValue(),
             temp.getProductLoad().getDangerous()));
   } catch (NullPointerException e) {
     System.out.println("Could not remove train car.");
   }
 }