示例#1
0
 public void loadCab(String cabName) {
   for (ExtendedCab cab : cabs) {
     if (cab.getName() == cabName) {
       ui.setCab(cab);
       break;
     }
   }
 }
示例#2
0
  public Controller() {
    String cabNames[] = {"Bob", "Larry", "Carl", "Steve", "Thomas", "Brady"};

    // For the sake of this program, MPG and tankSize are randomly generated.
    for (String cabName : cabNames) {
      cabs.add(new ExtendedCab(cabName, randDouble(12, 16), randDouble(20, 30)));
    }

    ui = new MultiCabUI(cabNames, this);
    ui.setCab(cabs.get(0));
  }