0
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.

Edited by plasticfood: n/a

1
Contributor
2
Replies
3
Views
7 Years
Discussion Span
Last Post by plasticfood
0

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;

}

Edited by plasticfood: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.