Month Class Write Class Named Month Class Int Field Named Monthnumber Holds Number Month E Q37186724

Month Class Write a class named Month. The class should have anint field named monthNumber that holds the number of the month. Forexample, January would be 1, February would be 2, and so forth. Inaddition, provide the following methods:

  • A no-arg constructor that sets the monthNumber field to 1.
  • A constructor that accepts the number of the month as anargument. It should set the monthNumber field to the value passedas the argument. If a value less than 1 or greater than 12 ispassed, the constructor should set monthNumber to 1.
  • A constructor that accepts the name of the month, such as“January” or “February”
    OR
    OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.