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, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
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