Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class Bus {
- private int capactity;
- public String destination;
- public ArrayList<Passenger> passengers;
- public int capacity;
- public Bus(int capacity, String destination) {
- this.passengers = new ArrayList<>();
- this.capactity = capacity;
- this.destination = destination;
- }
- public void addPassenger(Passenger passenger) {
- // if (passengers.size() < this.capacity) {
- this.passengers.add(passenger);
- }
- // }
- public int getPassengerCount() {
- return passengers.size();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement