I'm currently working on an assignment where it's asking me to modify my previous method. My current method is:
public ParkingTicket issueParkingTicket(ParkedCar car,ParkingMeter meter){
if(isParkingTimeExpired(car,meter) == true){
ParkingTicket ticket = new ParkingTicket(getOfficerName(),getBadgeNumber(),car.getLicenseNumber(),car.getCarMake(),car.getCarModel(),calculateFine(car, meter));
ticket.displayTicketDetails();
return ticket;
}
return null;
}
The collection is a collection of parking tickets (which is also a class "public class ParkingTicket). The method I wrote above resides in a different class (public class ParkingOfficer).
This method will create an object. Additionally I'd like this method to create the object and add it to the collection as an ArrayList. How would I do that?