Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO IT IN C++ AND MAKE SURE YOUR OUTPUT MATCHES THE OUTPUT GIVEN. EXPLAIN AS YOU CODE. KEEP IT BASIC. LOOK AT THE BOTTOM

PLEASE DO IT IN C++ AND MAKE SURE YOUR OUTPUT MATCHES THE OUTPUT GIVEN. EXPLAIN AS YOU CODE. KEEP IT BASIC. LOOK AT THE BOTTOM FOR 3 FILES.

image text in transcribed

main.cpp

#include

#include "dateType.h" using namespace std; int main() { int Month, Day, Year; while (true) { Month = 0; Day = 0; Year = 0; cout > Month; cout > Day; cout > Year; dateType dt; if (dt.setDate(Month, Day, Year)){ dt.printDate(); cout  

dateType.h

#ifndef dateType_H #define dateType_H class dateType { public: // check the format of month, day and year. // if the format is incorrect, displays a message and returns false // if the format is correct, returns true bool setDate(int month, int day, int year); //determines whether its a leap year or not bool isLeapYear() const; // returns current day int getDay() const; // returns current month int getMonth() const; // returns current year int getYear() const; // prints the current date void printDate() const; dateType(); private: int dMonth; int dDay; int dYear; }; #endif 

dateTypeImp.cpp

//Implementation file date #include  #include "dateType.h" using namespace std; void dateType::setDate(int month, int day, int year) { dMonth = month; dDay = day; dYear = year; } int dateType::getDay() const { return dDay; } int dateType::getMonth() const { return dMonth; } int dateType::getYear() const { return dYear; } void dateType::printDate() const { cout   A basic class datelvpe is designed to implement the date in a program, but the member function setDate does not check whether the date is in valid format Rewrite the definition of the function setDate so that the values for the month (1 to 12), day (1 to 31), and year (4 digits) are checked before storing the date into the member variables. Add amember function, isLeapYear, to check whether a year is a leap year a. b. Sample Output onth: 13 ay: 25 ear: 2017 onth is not valid lease enter proper date format onth: 12 ay: 35 ear: 2816 ay is not valid lease enter proper date format onth: 12 ay: 31 ear: 20017 ear is not valid lease enter proper date format onth: 12 ay: 31 ear: 2017 2-31-2017 eap year- ress any key to continue

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions