You are viewing a single comment's thread. Return to all comments →
private static int getFine(int day, int month, int year, int dueDay, int dueMonth, int dueYear) { int returned = year * 10000 + month * 100 + day; int due = dueYear * 10000 + dueMonth * 100 + dueDay; if (returned <= due) { return 0; } else if (year == dueYear && month == dueMonth) { return 15 * (day - dueDay); } else if (year == dueYear) { return 500 * (month - dueMonth); } else { return 10000; } } private static int funFee(int d, int m, int y, int dd, int dm, int dy) { return (y * 10000 + m * 100 + d) <= (dy * 10000 + dm * 100 + dd) ? 0 : y == dy && m == dm ? 15 * (d - dd) : y == dy ? 500 * (m - dm) : 10000; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →