Assignemnt #94 Month Name
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: MonthName
///File Name: MonthName.java
public class MonthName
{
public static String MonthName( int Month )
{
String result;
if ( Month==1)
result="January";
else if ( Month==2)
result="February";
else if ( Month==3)
result="March";
else if ( Month==4)
result="April";
else if ( Month==5)
result="May";
else if ( Month==6)
result="June";
else if ( Month==7)
result="July";
else if ( Month==8)
result="August";
else if ( Month==9)
result="September";
else if ( Month==10)
result="Octoberr";
else if ( Month==11)
result="November";
else if ( Month==12)
result="December";
else
result="Error";
return result;
}
public static void main( String[] args )
{
System.out.println( "Month 1: " + MonthName(1) );
System.out.println( "Month 2: " + MonthName(2) );
System.out.println( "Month 3: " + MonthName(3) );
System.out.println( "Month 4: " + MonthName(4) );
System.out.println( "Month 5: " + MonthName(5) );
System.out.println( "Month 6: " + MonthName(6) );
System.out.println( "Month 7: " + MonthName(7) );
System.out.println( "Month 8: " + MonthName(8) );
System.out.println( "Month 9: " + MonthName(9) );
System.out.println( "Month 10: " + MonthName(10) );
System.out.println( "Month 11: " + MonthName(11) );
System.out.println( "Month 12: " + MonthName(12) );
System.out.println( "Month 43: " + MonthName(43) );
}
}
Picture of Output