Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please look the the pictures to answer my question. Page 1 of 3 ZOOM + dateType Class We will be working on a project that

please look the the pictures to answer my question.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Page 1 of 3 ZOOM + dateType Class We will be working on a project that design a class calendarType, so that a client program can use this class to print a calendar for any month starting January 1, 1500. An example of the calendar for September 2019 is: September 2019 Sun Mon Tue Wed Thu Fri Sat 1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 We will develop several classes which will work together to create a calendar. We have already designed and implemented the dayType class. The next class we will develop will be the dateType class that store the year, month, and day for a specific date. The UML diagram for the dateType class looks like this: date Type -dMonth:int -dDay:int -dYear:int +setDate(int, int, int):void +setMonth(int):void +setDay (int):void +setYear(int):void -isLeap Year():boolPage 1 of 3 ZOOM + We will develop several classes which will work together to create a calendar. We have already designed and implemented the dayType class. The next class we will develop will be the dateType class that store the year, month, and day for a specific date. The UML diagram for the dateType class looks like this: date Type -dMonth:int -dDay:int -dYear:int +setDate (int, int, int):void +setMonth(int):void +setDay (int):void +set Year(int):void -isLeap Year():bool +print():void +numberOfDaysPassed():int +numberOfDaysLeft():int +incrementDate(int):void +getMonth():int +getDay ():int +get Year():int +getDaysInMonth ():int +dateType(int=1, int=1, int=1900) The constructor uses default parameters so it can serve as the default constructor or as a constructor with parameters. Since the constructor can potentially get input from the user, the date represented by the input parameters must be validated before it can be used to set the instance variables (see below).The function setDateO takes as parameters a month (between 1 and 12], a day [between 1 and the end date for the month], and the year [> 2 1501]]. The sethIonthO, setDayO, and setYearO functions set their respective instance variables separately. You will also need the isLeapYearO function which returns true if the value of the dYear instance variable represents a leap year, otherwise it returns false. The print function prints the date in the format mmdd-yyyy. The numberO EDaysPassedU and numberO fDaysLeftO, return the respective values relative to the date represented by the instance parameters. The incrementDateO function adds the number of days sent in as an input parameter to change the date represented by the instance parameters. These functions are complicated due to the dependencies described below and will be the most Likely to require algorithm development and unit testing. The getb'lontho, getDay 0, getYearO functions return the value of their respective instance variables. The getDays InMonthO function returns the number of days in the month represented by the dNIonth instance variable. I have supplied you with the header le. You are to write the code for the implementation file and write a client program to test the class. The integration test for this class is tridcy since there is a dependency between the instance variables (e. g., If the month is April, the day cannot be > 30]. If the month is February and the year is a leap year, the number of days in the month is 28 instead of 29. The dependencies will affect the operations for number-O fDaysPassedO, numberOfDaysLeftO, and incrementDateO, as well as the validation of the set functions. It is best to let the user of the class know about this dependency at the beginning of the header file. For example, when changing a date using the individual setters, setMonthO, setDayO, setYearO, the order should be to change the year first, then the month, and change the day last. Using setDaleO will eliminate potential problems with using the setters for the individual components. Here is example of output from an integration test for this class: Page 3 of 3 ZOOM + > clang++-7 -pthread -std=c++17 -o main date > . /main Default constructor: 1-1-1900 Constructor: 2-20-2003 Number of days passed: 51 Number of days left: 314 Number of days in month: 28 After 15 days, date will be: 3-7-2003 0ooz :0002 07 Teak Burqasay 0OOZ-L-E Resetting month to 2: 2 0OOZ-L-Z Resetting day to 29: 29 2-29-2000 Date is now set to: 2-29-2000 Can't set date to 2-29-2001 Resetting year to 2001: 2001 Date is now set to: 2-1-20014 because 2001 is not a leap year Resetting month to 0: 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial Accounting For Dummies

Authors: Mark P Holtzman, Karen Schoenebeck

1st Edition

1118116429, 978-1118116425

More Books

Students also viewed these Accounting questions

Question

Go, do not wait until I come

Answered: 1 week ago

Question

Make eye contact when talking and listening

Answered: 1 week ago