Question: URGENT C++ HELP!! Create a class that represents a Date. A Date object has the following information: int month, as a number from 1 -
URGENT C++ HELP!!
Create a class that represents a Date. A Date object has the following information:
- int month, as a number from 1 - 12
- int day, as a number from 1 - 31
- int year, as a number that is not negative
The Date class has the following functions:
- int getMonth()
- Description: returns the month from the object in number form
- int getDay()
- Description: returns the day from the object
- int getYear()
- Description: returns the year from the object
- void setMonth(int new_month)
- Assigns the new_month value to the object's month
- This function needs to make sure the new_month is a number from 1 - 12
- void setMonth(string new_month)
- This function takes in the new_month as a 3 character string, such as JAN or MAR and stores the appropriate number in for the object's month
- void setDay(int new_day)
- This function assigns the new_day value to the object's day.
- This function needs to make sure the day is a value from 1 - 31
- void setYear(int new_year)
- This function assigns the new_year value to the object's year.
- This function needs to make sure the year is a value >= 1
- void printDateNumerical()
- This function prints the date in the following format: MM-DD-YYYY
- void printDate()
- This function prints the date using the month name as in the following example: January 1, 2020
Main Driver File Instructions
1: Create a Date object and set the date to your birthday for this year. Then print this date using the printDateNumerical() function and the printDate() function.
2: Then ask the user for a new date and store it in the object created in step 1 (Hint: Use the functions that begin with set).
Part 3: Display the new user date using the printDateNumerical() function and the printDate() function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
