Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Month class to hold a months name and number. The constructor accepts an integer argument and uses that integer to initialize the months
Write a Month class to hold a months name and number. The constructor accepts an integer argument and uses that integer to initialize the months number and name properly.
Write an programmer defined exception class InvalidMonthException for the following error condition:
- A number less than 1 or greater than 12 is given for the month number
- Modify the Month class in Q1 so that the constructor throws the appropriate exception when an invalid month number is given for the constructor
- Demonstrate the classes in a demo program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started