# How many days in a month?

I have to write a script that will tell the user how many days are in a certain month in the year they have entered.  The exercise is using nested selection.  Where am I going wrong here?  It compiles ok but when I enter the year it doesn't ask me for the month, it just tells me there are 31 days

TIA Flo
``````// Days in Month

import java.util.*;

public class DaysInMonth

{

public static void main (String[]args)

{
//create scanner from keyboard

Scanner myKeyboard = new Scanner (System.in);

//prompt for year

int year = myKeyboard.nextInt();

//prompt for month
String month = myKeyboard.nextLine();

//Determine if it is a leap year
boolean isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);

//calculate and return result

if (month.equals("february"))

{
if (isLeapYear = true)
{
System.out.print("There are 29 days");
}
else
{
System.out.print("There are 28 days");
}
}
else if (month.equals("november"))
{
System.out.print("There are 30 days");
}
else if (month.equals("april"))
{
System.out.print("There are 30 days");
}
else if (month.equals("june"))
{
System.out.print("There are 30 days");
}
else
{
System.out.print("There are 31 days");
}
}
}
``````
LVL 1
###### Who is Participating?

x

Author Commented:
It's ok, I fixed it myself.  I got it to ask the month before the year and it worked.  YAY!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.