Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following definition for the Date class should be placed atthe top of the CP

ID: 3615557 • Letter: T

Question

The following definition for the Date class should be placed atthe top of the CPP file:

The Date class contains five data members that are not availableto the outside world. They are:

The two arrays both hold constant values but they cannot beinitialized in the Date class definition because the definition issimply a pattern for what an object will "look like" when it iscreated. This means that there is no memory allocated for the classdefinition and therefore the two arrays must be initialized outsideof the class definition. Place the following arraydeclaration/initialization statements at the top of the CPP fileafter the closing curly brace for the class definition.

Note 1: The arrays hold thirteen thirteen itemssp that the month number can be used as a direct subscript toaccess a value. For example, to access the number of days in Marchuse the statement monthDays[3].

Note 2: The class disregards leap years.

The constructor for this class is used to initialize a Dateobject to a specific date. It takes three arguments: the initialmonth, the initial day, and the initial year. The passed in valuesshould only be used if they are valid. The month value should bebetween 1 and 12, inclusive. If it is invalid, set the month toJanuary. The day value should be between 1 and the maximumnumber of days in the current month, inclusive. If it is invalid,set the number of days to the maximum for the current month. Theyear value should be positive. If it is invalid, set the year to2009.

Note/Hint: think about calling the setDatemethod that is described next.

This method sets the date for the current object. It takes threearguments: the value for the month, the value for the day, and thevalue for the year. The passed in values should only be used ifthey are valid. The month value should be between 1 and 12,inclusive. If it is invalid, set the month to January. Theday value should be between 1 and the maximum number of days in thecurrent month, inclusive. If it is invalid, set the number of daysto the maximum for the current month. The year value should bepositive. If it is invalid, set the year to 2009.

This method prints the current date in the Date object in theformat "monthName day, year". For example, if the month value is11, day is 30, and year is 1977, then this method will print"November 30, 1977".

This method calculates and returns the number of days that havepassed from the beginning of the year up to and including thecurrent date in the Date object.

Hint: To get started, think about writing aloop that will add up the maximum number of days in each month upto the current month in the Date object.

This method calculates and returns the number of days that areleft in the current year in the Date object. This will only countthe days after the current date in the Date object.

Hint: To get started, think about writing aloop that will add up the maximum number of days in each monthAFTER the current month in the Date object through December.

This part of the assignment is going to use the Date classdescribed above. Create four Date objects with the values:

For each of the objects, display the following:

The output for this assignment should resemble thefollowing:

Explanation / Answer

The problem is quite clear and i dont think you should not have anyproblem is solving that, what exactly you wanted to ask?

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote