1 2 Previous Next 15 Replies Latest reply on Mar 23, 2009 2:25 PM by 807588

    arraylist methods help please

    807588
      i am having trouble with a couple of my methods in one of my classes. i have 4 classes that are creating a car hire system. one class creates a car, another person and another controller. some help with my carstore class would be much appreciated. even some hints would be good. below is my code. the ones with the comments todo is where i need help. if you need any help please ask. thanks



      -----------------------------------------------

      import java.util.ArrayList;
      import java.oi.*;

      public class CarStore implements Serializable {

      String name;

      ArrayList<Car> carsArray;
      ArrayList<Person> peopleArray;

      public CarStore(String name) {
      this.name = name;
      carsArray = new ArrayList<Car>();
      peopleArray = new ArrayList<Person>();
      }

      public String getName() {
      return name;
      }

      public ArrayList<Car> getCars() {
      return carsArray;
      }

      public ArrayList<Person> getPeople() {
      return peopleArray;
      }

      public void addCar(Car aCar) {
      this.carsArray.add(aCar);
      }

      public void removeCar(Car aCar) {
      this.carsArray.remove(aCar);
      }
      public void addPerson(Person aPerson) {
      this.peopleArray.add(aPerson);
      }
      public void removePerson(Person aPerson) {
      this.peopleArray.remove(aPerson);
      }

      public boolean takeOut(Car aCar, Person aPerson) {
      return false;//TODO
      }

      public boolean takeIn(Car aCar) {
      return false;//TODO
      }

      public ArrayList<Car> getCarsForPerson(Person aPerson) {
      return null;//TODO
      }

      public ArrayList<Car> getAvailableCars() {
      return null;//TODO
      }

      public ArrayList<Car> getUnavailableCars() {
      return null;//TODO
      }
        1 2 Previous Next