Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C++ console application that defines a Date class. The class should declare 3 integer data members for the year, month, and day. Define

image text in transcribed
Create a C++ console application that defines a Date class. The class should declare 3 integer data members for the year, month, and day. Define a 3-arg constructor which performs validation of the month and day and then initializes the data members. The month value should be between 1 and 12, and the day value should be validated for the given month. February can be assumed to have 28 days. If validation fails then an error message should be printed to the screen and the application should exit using the exit) function. Define 3 accessor functions for the private data members. Define a member function named compareDates which should accept a Date object as a constant reference parameter. The method should compare the data members of each object and then print out the dates in chronological order. Define a private member function named print Date which will handle the printing of dates in a consistent format. This method should be very short. From main, prompt the user for input and then create 2 Date objects. Call the compareDates method on one of th passing the other object as the argument to the method

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

Students also viewed these Databases questions