Hello, I need help with figuring out the logic to print the day number of the year. The directions for my homework are: Write a program that prints the day number of the year, given the date is in the form: month day year. For example, if the input is 1 1 05, the day number is 1; if the input is 12 25 05, the day number is 359. The program should check for a leap year . I have a basic outline of the program but i am having trouble with figuring out the logic to display the day number of the year given the date. This is what i have so far
import javax.swing.JOptionPane; public class Practice4 { public static void main(String[] args) { String monthStr; String dayStr; int inputMonth; int inputDay; String yearStr2; String dayStr2; int inputyear2; int inputDay2; String[] Months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; int[] Days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; monthStr = JOptionPane.showInputDialog(null, "Enter the Month: "); inputMonth = Integer.parseInt(monthStr); dayStr = JOptionPane.showInputDialog(null, "Enter the Day: "); inputDay = Integer.parseInt(dayStr); yearStr2 = JOptionPane.showInputDialog(null, "Enter the year: "); inputyear2 = Integer.parseInt(yearStr2); JOptionPane.showMessageDialog(null, );//To display the day number of the year public static int dayNumber(int dayCount)//Method for logic to find day number { for( )//Need help figuring out logic to print day number of the year { boolean isLeapYear = (year % 4 == 0 && year % 100 != 0)||(year % 400 == 0); //accounting for leap year(probably doesnt go here) } } } }