Hello,
I need some help writing code that will calculate late fees. The code needs to return 0.0 if the item is not overdue and caluclate a late fee of .75 for every day overdue. Below is what I have so far. The problem I am having is trying to get the Money object to multiply by the double or int object . I also tried to increment the fee for each day it is overdue, but that doesn't work either. Any suggestions?
I need some help writing code that will calculate late fees. The code needs to return 0.0 if the item is not overdue and caluclate a late fee of .75 for every day overdue. Below is what I have so far. The problem I am having is trying to get the Money object to multiply by the double or int object . I also tried to increment the fee for each day it is overdue, but that doesn't work either. Any suggestions?
Code:
public Money calculateFees(GregorianCalendar currentDate)
{
overdue = currentDate.compareTo(dueDate);
if (overdue <= 0)
{
return NO_FEE;
}
for (int i = 0; i <= overdue; i++)
{
if(overdue > 0)
{
fee = OVERDUE_FEE++;
}
return fee;
}
}
Comment