I guess it's a simple question, but I've just started to learn! :P
I need to invoke the ParkingTicket(parker, parkee) constructor in the checkParking() gateway method (if the "if" statement is true) but I'm getting the following error: incompatible types: int cannot be converted to Car
public class ParkingTicket
{
private static int count = 1000;
private final String referenceNumber;
private final String carLicensePlate;
private int carMinutesParked;
private int meterMinutesPaid;
private static final String prefix = "V";
private ParkingTicket(String recordedLicense, int carParkedMinutes, int meterPaidMinutes)
{
count = (count + 1);
referenceNumber = prefix + count;
carLicensePlate = recordedLicense;
carMinutesParked = carParkedMinutes;
meterMinutesPaid = meterPaidMinutes;
}
private ParkingTicket(Car parker, ParkingMeter parkee)
{
this(parker.getLicensePlate(),
parker.getMinutesParked(),
parkee.getMinutesPaid());
}
public static int checkParking(Car minutesParked, ParkingMeter minutesPaid)
{
if (minutesParked.getMinutesParked() > minutesPaid.getMinutesPaid())
{
new ParkingTicket(minutesParked.getMinutesParked(), minutesPaid.getMinutesPaid());
}
else
{
ParkingTicket pt1 = null;
}
}
}
Thanks in advance for all the help!