public class PoliceOfficer { String officerName; double badgeNumber; ParkedCar carInfo; ParkingMeter meter; double timeParked; double timePurchased; //constructor to get name and badge number PoliceOfficer(String name,double number,ParkedCar car,ParkingMeter met) { officerName=name; badgeNumber=number; carInfo=car; meter=met; } public ParkingTicket ticketTest() { if(carInfo.getMinutesParked()>meter.getMinutesPurchased()) { ParkingTicket ticket=new ParkingTicket(carInfo.getMinutesParked(),meter.getMinutesPurchased(),carInfo); } return ticket; } public String toString() { String str=" "+ticketTest()+" the officers name and badge number are "+officerName+" and "+badgeNumber; return str; }
My error message tells me that in the police officer class it can not find ticket where it says "return ticket" inside the ticketTest methodpublic class ParkingTicket { private double minutesParked; private double minutesPurchased; double fineAmount=25; ParkedCar carInfo; //constructor to get car and meter data ParkingTicket(double parked, double purchased,ParkedCar car) { minutesParked=parked; minutesPurchased=purchased; carInfo=car; } //method to return the fine amount public double getFineAmount() { for(double i=minutesParked;i<minutesPurchased;i++) { fineAmount=fineAmount+10; } return fineAmount; } public String toString() { String str=carInfo+" your fine amount is "+getFineAmount(); return str; } }
thanks