Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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), and 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, YYYY (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. need help in c++ please

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

Students also viewed these Databases questions