8/7/2021 Lab 13 - The Date Class
https:
miracosta.instructure.com/courses/26283/assignments/616486?module_item_id= XXXXXXXXXX/3
Lab 13 - The Date Class
Due Jul 29 by 11:59pm Points 20 Submitting a file upload
Start Assignment
A "Date" class
(20 points)
Please perform this lab individually
or in groups of 2 or 3.
Module 13 – Dates
Summary
In this lab you'll create a class that represents a date (month, day, year) using a header ".h" file and
an implementation ".cpp" file.
Description
Design a class called Date that has integer data members to store month, day, and year.
All of the member functions except getters in the Date class should have prototypes inside the
class, and have their definitions outside of the class.
The class should have a three-parameter constructor that allows the date to be set at the time a
new Date object is created. It's heading should be:
Datee(inttmonth,,inttday,,inttyear))
with the following default values defined in the heading of the prototype:
the default month should be 1 (January)
the default day should will be 1
8/7/2021 Lab 13 - The Date Class
https:
miracosta.instructure.com/courses/26283/assignments/616486?module_item_id= XXXXXXXXXX/3
the default year will be 2000
The constructor should print the values of the three parameters before doing any data validation.
Be sure that your Date constructor accepts only reasonable values for month, day, and year:
the month should be between 1 and 12
the day should be between 1 and the number of days in the selected month (use 29 fo
Fe
uary)
the year should be between 1900 and 2099
If the user tries to create a Date object using any invalid argument, then use default values of 1, 1,
2000 (i.e., January 1, 2000) for the values of month, day, and year. As a suggestion, you might
create a private function named checkDates in the Date class which verifies the values of
month, date, and year to these values. Call this function at the very of the code in the constructo
and/or in setters.
In addition to all getters and setters, the class should also have four member functions to print the
date in the following four formats:
3/15/2019
March 15, 2019
15.March.2019
XXXXXXXXXX
Note that in the last format, the day and month are always displayed to 2 digits. Try to do this using
the I/O manipulators setfill and setw, or else using one or more ternary operators.
Only the getters should be defined inside the body of the class. All other function definitions should
appear outside of the class (prototypes inside the class).
The class should have a header file (Date.h) and a specification file (Date.cpp). Your main
function should be in its own .cpp file.
In main demonstrate what happens when the following month/day/year combinations are provided
to your Date class constructor. For valid dates, please show that date using all 4 display formats.
For invalid dates, just show one format.
month 1, day 5, this yea
month 9, day 14, 1970
month 12, day 31, next yea
month 4, day 31, this year (invalid day)
month 13, day 1, this year (invalid month)
month 8, day 15, 2100 (invalid year)
8/7/2021 Lab 13 - The Date Class
https:
miracosta.instructure.com/courses/26283/assignments/616486?module_item_id= XXXXXXXXXX/3
Submit all C++ program files (Date header, Date function implementations, and the file containing
main) as well as print screens or snips showing the results of running your tester program with the six
test cases above.
Additional Files Next La
none Lab 14 - Introduction To A
ays
Homework for this Module Prior La
Homework 13 Lab 12 - Traveling by Ai
https:
miracosta.instructure.com/courses/26283/assignments/616487
https:
miracosta.instructure.com/courses/26283/assignments/616473
https:
miracosta.instructure.com/courses/26283/assignments/616485