Question: Create a Date class int day int month Implement accessor/mutator functions Create constructors (make sure to also define the default constructor) for the Date class

Create a Date class

int day

int month

Implement accessor/mutator functions

Create constructors (make sure to also define the default constructor) for the Date class

Pick a reasonable default value for day/month

You should have three constructors

Implement error checking

Check month validity

Check day validity

main() function

Infinite loop to ask the user to enter a month and a day (in that order)

If user enters 0 for month and 0 for day, call default constructor

If user enters 0 for month and not 0 for day, call appropriate constructor

If user enter non-zero values for both month and day, then call the appropriate constructor

If user enters negative numbers for both month and day, then quit

Implement static private variable totalDates

To count number of valid dates entered

Incremented each time constructor is called

Function to return totalDates (static)

Reminder: Initialize static variable outside of class

Create a Date class int day int month Implement accessor/mutator functions Create

include kiostream using namespace std; 4 class Date f 5 public 7 private 10 11 int main. 12 while (true) 13 int month day 14 cout Enter month endl 15 cin month; 16 cout Enter day endl; 17 cin day; 18 E if day 0 && month 0) 19 Date date 20 cout Number of dates date getTotal Dates endl; 21 22 E if day 0 && month 0) Date date (day) 23 24 cout Number of dates date getTotal Dates endl; if day 0 && month 0) 26 Date date (day, month) 27 28 cout Number of dates date getTotal Dates endl; 29 30 31 32 L

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!