Beispiel #1
0
  public static Customer getCustomer(int customerNumber) {
    Customer barbara = new Customer();
    barbara.setName("Barbara White");
    barbara.setAddress("3400 Richmond Parkway #3423");
    barbara.setCity("Bristol");
    barbara.setState("CT");
    barbara.setPostalCode("06010");

    if (customerNumber == 1001) {
      return barbara;
    }

    Customer karl = new Customer();
    karl.setName("Karl Vang");
    karl.setAddress("327 Franklin Street");
    karl.setCity("Edina");
    karl.setState("MN");
    karl.setPostalCode("55435");

    if (customerNumber == 1002) {
      return karl;
    }

    Customer ronda = new Customer();
    ronda.setName("Ronda Chavan");
    ronda.setAddress("518 Commanche Dr.");
    ronda.setCity("Greensboro");
    ronda.setState("NC");
    ronda.setPostalCode("27410");

    if (customerNumber == 1003) {
      return ronda;
    }

    return null;
  }
  private Customer buildCustomer() {
    Customer customer = new Customer();

    customer.setFirstName(firstNames[generator.nextInt(firstNames.length - 1)]);
    customer.setMiddleInitial(
        String.valueOf(middleInitial.charAt(generator.nextInt(middleInitial.length() - 1))));
    customer.setLastName(lastNames[generator.nextInt(lastNames.length - 1)]);
    customer.setAddress(
        generator.nextInt(9999) + " " + streets[generator.nextInt(streets.length - 1)]);
    customer.setCity(cities[generator.nextInt(cities.length - 1)]);
    customer.setState(states[generator.nextInt(states.length - 1)]);
    customer.setZip(String.valueOf(generator.nextInt(99999)));

    return customer;
  }
Beispiel #3
0
  /**
   * Get a customer to put in the database
   *
   * @param id for the customer
   * @param warehouse for the customer
   * @param station for the customer
   * @return customer
   */
  public Customer getCustomer(int id, Warehouse warehouse, Station station) {
    Customer customer = new Customer();

    customer.setCustomerID(id);
    customer.setWarehouseID(warehouse.getWarehouseID());
    customer.setStationID(station.getStationID());
    customer.setFirstName(fnames.get(randInt(0, fnames.size())));
    customer.setMiddleInitial(letters[randInt(0, letters.length)]);
    customer.setLastName(lnames.get(randInt(0, lnames.size())));
    customer.setAddress(randAddress());
    customer.setCity(cities.get(randInt(0, cities.size())));
    customer.setState(states.get(randInt(0, states.size())));
    customer.setZip(zips.get(randInt(0, zips.size())));
    customer.setPhone(randInt(100, 1000) + "-" + randInt(100, 1000) + "-" + randInt(1000, 10000));
    customer.setDateAdded(randDate());
    customer.setDiscount(new BigDecimal(randDouble(minDiscount, maxDiscount)));
    customer.setBalance(new BigDecimal(0));
    customer.setTotalPaid(new BigDecimal(0));
    customer.setNumPayments(0);
    customer.setDeliveriesReceived(0);

    return customer;
  }