An AI assistant wrote this method for StudyBuddy's calendar:
// Returns true if the year is a leap year
static boolean isLeapYear(int year) {
return year % 4 == 0;
}
It looks right and works for 2023 and 2024 — but it is wrong. The real (Gregorian) rule: a year is a leap year if it is divisible by 4, except years divisible by 100, unless they are also divisible by 400.
Write a program that reads n years and, for each, prints the AI's answer, the correct answer, and whether they agree:
1900: ai=true correct=false MISMATCH
or, when they agree, ... OK. Finally print Mismatches: k, and then Verdict: REJECT the AI code if k > 0, otherwise Verdict: no difference found on these tests.
Input:
4
2024
1900
2000
2023
Output:
2024: ai=true correct=true OK
1900: ai=true correct=false MISMATCH
2000: ai=true correct=true OK
2023: ai=false correct=false OK
Mismatches: 1
Verdict: REJECT the AI code
Notice the second verdict: passing your tests never proves the code is correct — it only means you found no difference on these tests.