Write a class name month. The class should have an int field named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, etc. The class should also have appropriate constructors and getter / setter methods. There should also be a getMonthName that returns the name of the month corressponding to the month number. Also include exception code when a number less than 1 or greater than 12 is given in the constructor and/ or the set method. Demonstrate the classess and catching the exception in a program, such as Month Test. Display appropriate information

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Data structure & Algorithum java program

Write a class name month. The class should have an int field named monthNumber that holds the number of the month. For example, January would be 1, February would be 2, etc. The class should also have appropriate constructors and getter / setter methods. There should also be a getMonthName that returns the name of the month corressponding to the month number. Also include exception code when a number less than 1 or greater than 12 is given in the constructor and/ or the set method. Demonstrate the classess and catching the exception in a program, such as Month Test. Display appropriate information to the user if an erro occurs. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,