subject

Create a class called Date that has integer data members to store month, day, and year. The class will have a 3-parameter constructor that allows the date to be created by specifying the numerical month, day, and year. If the user creates a Date object when any of the values passed are invalid, an invalid argument exception should be thrown with appropriate text: • The month must be a valid month (1-12)
• The day must be in the appropriate range for that month (do not worry about leap years)
• The year must be between 1950 and 2020. Include mutator methods for setting the month, day, and year.

These should also throw invalid parameter exceptions if invalid parameters are provided. Include a toString() method that displays the date in the format "Month DD, " (ex: August 22, 1984). Create a program that utilizes this class to create and display dates based on user input. Utilize try-catch blocks to validate the user input. Demonstrate usage of the class and its embedded exception handling.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:10
Chiko bought 75 shares of stock at $19.58 per share. he received dividends of $73.42 during the year. at the end of the year, his stock was valued at $22.14. what was his purchase price?
Answers: 2
question
Computers and Technology, 23.06.2019 01:00
Complete the sentence about a presentation delivery method
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
You know the right answer?
Create a class called Date that has integer data members to store month, day, and year. The class wi...
Questions
question
Biology, 28.07.2019 05:30
question
Mathematics, 28.07.2019 05:30
Questions on the website: 13722363