Hello,
I have this error: Missing return statement :27
But I do not know it is a good way to solution this task?
The date is inicjalized in line 12, and this is my input and output at the same time, right?
package pl.codegym.task.task08.task0827;
import java.text.SimpleDateFormat;
import java.util.Date;
/*
Praca z datami
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isDataNieparzysta("MAY 1 2013"));
}
public static boolean isDataNieparzysta(String date) {
new SimpleDateFormat ("D"); // I am setting format to "D" Day in year
SimpleDateFormat format = new SimpleDateFormat(date); // Formating date
String stringDate = format.toString(); // I am changing variable format from date to string and then to integer,
// to have the ability to get modulo from day count.
// If modulo is higher from 0, inserted date had odd day in year.
int intDate = Integer.parseInt(stringDate);
if (intDate%2 > 0)
return true;
}
}