I do not have errors, but I am unsure I have everything I need for my "show month" file. Code is below, thanks for the help!
Month
import java.util.Scanner;
public class Month
{
//variables that declare the monthName String and int monthNum
static String monthName;
static int monthNum = 0;
public void monthInput()// asking for user input then becomes an assigned value
{
Scanner input = new Scanner(System.in);
System.out.println("Hello! Please enter a month number:");
monthNum = input.nextInt();
}
public static void monthName()// assigns month numbers to their names
{
switch(monthNum)
{
case 1:
monthName = "January";
break;
case 2:
monthName = "February";
break;
case 3:
monthName = "March";
break;
case 4:
monthName = "April";
break;
case 5:
monthName = "May";
break;
case 6:
monthName = "June";
break;
case 7:
monthName = "July";
break;
case 8:
monthName = "August";
break;
case 9:
monthName = "September";
break;
case 10:
monthName = "October";
break;
case 11:
monthName = "November";
break;
case 12:
monthName = "December";
break;
}
}
public static void DisplayMonth()// to display a message to the user that includes their input
{
System.out.println("The month number keyed by you is" + monthNum + "\nwhich is the motnh of " + monthName);
}
}
Show Month
public class ShowMonth // declared class
{
public static void main(String[]args)// main method of class
{
new Month().monthInput();// enter a new month object
Month.monthName();
}
}