public double returnTotalFine(){
	
if (parkingmeter.returnPurchasedMins() >= parkedcar.returnMinsParked()){
	fine = 0;
}
else if (parkingmeter.returnPurchasedMins() - parkedcar.returnMinsParked() <= 60){
	fine = 25;
} 

else{
	fine = (25 + (10 * (parkedcar.returnMinsParked() / 60.0))); 
}
		
return fine;
		
			
}

this is the toString method from the same class as above:

public String toString(){
return ("fine is: " + fine);
}

and then i print that toString method from another object. i always get 0.0 no matter what.

ok so now i'm getting a "Exception in thread "main" java.lang.NullPointerException
at ParkingTicket.returnTotalFine(ParkingTicket.java:29)"


if (parkingmeter.returnPurchasedMins() >= parkedcar.returnMinsParked()){

fine = 0;

}

nevermind. i fixed it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.