Skip to content

Instantly share code, notes, and snippets.

@dj-amadeous
Created October 9, 2016 04:57
Show Gist options
  • Save dj-amadeous/289206a4ce4de0d285757d6a94e16c4b to your computer and use it in GitHub Desktop.
Save dj-amadeous/289206a4ce4de0d285757d6a94e16c4b to your computer and use it in GitHub Desktop.
the already written bottom part
public static int findMoNum(String mo)
{
int numMo = 1; // default value for month will be January if invalid input is given
if (mo.equalsIgnoreCase("Jan"))
{
numMo = 1;
}
else if (mo.equalsIgnoreCase("Feb"))
{
numMo = 2;
}
// write the code for the missing months
else if (mo.equalsIgnoreCase("Mar"))
{
numMo = 3;
}
else if (mo.equalsIgnoreCase("apr"))
{
numMo = 4;
}
else if (mo.equalsIgnoreCase("May"))
{
numMo = 5;
}
else if (mo.equalsIgnoreCase("jun"))
{
numMo = 6;
}
else if (mo.equalsIgnoreCase("Jul"))
{
numMo = 7;
}
else if (mo.equalsIgnoreCase("aug"))
{
numMo = 8;
}
else if (mo.equalsIgnoreCase("Sep"))
{
numMo = 9;
}
else if (mo.equalsIgnoreCase("oct"))
{
numMo = 10;
}
else if (mo.equalsIgnoreCase("nov"))
{
numMo = 11;
}
else if (mo.equalsIgnoreCase("Dec"))
{
numMo = 12;
}
return numMo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment