Write a program that asks the user to enter a month (1 = January, 2 = February, and so on) and then prints the number of days of the month. For February, print “28 days”.

Enter a month (1-12):
31 days

Implement a class Month with a method int getDays(). Do not use a separate if or else statement for each month. Use Boolean operators.

Complete the following files:



Use the following file:


import java.util.Scanner;

   This program prints the months in a given year.
public class MonthPrinter
   public static void main(String[] args)
      Scanner in = new Scanner(System.in);      
      System.out.println("Enter a month (1-12):");
      int month = in.nextInt();
      Month m = new Month(month);
      int days = m.getDays();
      System.out.println(days + " days");