Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer the following in C++ please, thank you. Define a class named Date with three private data members named month (integer), day (integer), and

Please answer the following in C++ please, thank you.

image text in transcribed

Define a class named Date with three private data members named month (integer), day (integer), and year (integer) as follows: - This class has a private member function void checkDate( ) that validates a date as follows: - The month must be an integer value from 1 to 12 . - The day must be an integer value from 1 to 31 . - The year must be an integer value from 1960 to 2011. - Function checkDate( ) calls the library function exit( ) to terminate the program if any of the above conditions is not satisfied. - This class default constructor sets the month data member to 1, the day data member to 1, and the year data member to 1960: The default date is 1/1/1960. - The class constructor with parameters calls function checkDate( ) to check the date after it has set the values for the data members month, day, and year. - The class also has the following public member functions: - void inputDate( ) that reads the values for the data members month, day and year, and then calls function checkDate( ) to check the date. - void outputDate( ) that prints the date in the format: month/day/year. - int getMonth( ), int getDay( ), and int getYear( ). These functions return the value of the month data member, the value of the day data member, and the value of the year data member respectively. - Place the definition of the class in the header file Date.h, and the definitions of the functions in the source file Date.cpp. - Note: the header files iostream, iomanip, cstdlib, and Date.h must be included in the source file Date.cpp

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_2

Step: 3

blur-text-image_3

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

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

Address the customer by name.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago