Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Date.h #include #ifndef DATE_H #define DATE_H class Date{ public: Date (unsigned int = 1, unsigned int = 1, unsigned int = 2000); void setDate(unsigned int
Date.h #include#ifndef DATE_H #define DATE_H class Date{ public: Date (unsigned int = 1, unsigned int = 1, unsigned int = 2000); void setDate(unsigned int m, unsigned int d, unsigned int y); void setMonth(unsigned int m); void setDay(unsigned int d); void setYear(unsigned int y); unsigned int getMonth() const; unsigned int getDay() const; unsigned int getYear() const; std::string toString() const; std::string fullDisplay() const; private: unsigned int month{0}; unsigned int day{0}; unsigned int year{0}; }; #endif
Date.cpp #include#include #include #include #include "Date.h" Date::Date(unsigned int m, unsigned int d, unsigned int y) { setDate(m, d, y); } void Date::setDate(unsigned int m, unsigned int d, unsigned int y) { setMonth(m); setDay(d); setYear(y); } void Date::setMonth(unsigned int m) { if (m >= 1 && m = 1 && d 3.1a Using the Date class built in class, allow the user to input a date in the format MM/DD/YYYY. Use an input stringstream to parse the individual month, day and year out of the input for the date object. 3.1b Test the input of a date in the format MM/DD/YYYY and create a Date object with that information. Call the Date to_string function to see that the date in the object is the same as the date input. 3.2a Using the Date class built in class, create a member function fullDisplay that will display the date with the full text representation of the month. For example, 01/05/2019 would display as January 5, 2019. 3.2b Test your fullDisplay function with dates in each month and see that the month displays correctly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started