Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Traffic {
- import java.util.Map;
- int carNum;
- int[] speedArray = new int[carNum];
- Car[] carArray = new Car[carNum];
- private Map cars = new HashMap();
- Traffic(int tempCarNum, int tempSpeed){
- carNum = tempCarNum;
- for(int n = 0; n < speedArray.length; n++) {
- speedArray[n] = tempSpeed;
- }
- }
- void createObject() {
- for(int i = 0; i < carNum; i++) {
- carArray[i] = new Car(30, 300, color(255, 0, 0), color(100, 255, 100), 10, true);
- }
- }
- void addCar(String carID, Car car) {
- cars.put(carID, car);
- }
- private Car getCar(String carID) {
- return cars.get(carID);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement