Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CALMAIN FILE DATEMAIN FILE DAYMAIN FILE CS 202 - Assignment #3 Purpose: Points: Learn class inheritance, multi-file class implementation and make utility. | 100 Assignment:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

CALMAIN FILE

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

DATEMAIN FILE

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

DAYMAIN FILE

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

CS 202 - Assignment #3 Purpose: Points: Learn class inheritance, multi-file class implementation and make utility. | 100 Assignment: Design and implement three C-- classes to provide a series of calendar date support functions., dayType, dateType, and calendar Type. Each of the classes is described below. CALENDARIO MEANINGFUL DATES EACHDESSZEREPES OFTEN ITS REFERRED BY ME EsOCIBER ) NENGUSH-UNGAGE BOOKS SINCE 2000 dayType Implement a basic dayType class to provide basic date functions. The day Type UML class diagram is as follows: 4 JANUARY FEBRUARY Moo 1234561 17 HKCH17 290u 557a921456789 02281557 E2311567 1 In msgD ht N685 talgi 5 =ng * AE278 29S MS 11gBan10 Tag H5 MA ma bBR 2 18 Telnmph bt36885 K5 SH6 wbSA Hn _MA.25kg 1a 796B8A les Tag 1868 5 &qn 25 b H7r 195 Q68B dayType #month: int *date: int #year: int -zzy-Trairc='...-1, nr=1271] +printDate() const: void +getDate() const: int +getMonth() const: int +getYear( const: int +3etDate(int, int, int) : void +readDate(): void +nextDay(): void +nextDay (int) : void +prevDay(): void +prevDay (int) : void #isleapYear (int) const: bool #daysInMonth (int, int) const: int SEPTEMBER 1 235673 35: 59 br8 ba 92017 235 33 2829 9 99 Source: http://xkcd.com/1140 Function Descriptions The following are more detailed descriptions of the required functions. The constructor dayType(int,int,int) function should set the date to the passed values (month, date, year in that order). The passed values must be checked for valid dates, including the date for the given month and year. The year must be between 1800 and 3050 (inclusive). If any date value is incorrect, the date should be set to the default. 1/1/1970 date. The printDate() function should print the date in the mm/dd/yyyy format. Refer to the example executions for formatting The get Month().getDate(), and getYear() functions return the current values for each. The nextDay and prevDay() functions increment or decrement the current class date one day, changing month and or year if necessary. The nextDay(int) and prevDay(int) functions increment or decrement the current class date by the number of days passed (changing month and/or year if necessary). The setDate/month, date, year) function should set the date based on the passed values. The passed values must be checked for valid dates, including the date for the given month and year. The year must be between 1800 and 3050 (inclusive). If any date value is incorrect, the date should be set to the default, 1/1/1970 date. The readDate/ function should read the date form the console in the mm/dd/yyyy format and include appropriate error checking. The year must be between 1800 and 3050 (inclusive). The function should re-prompt until a value date is provided. Refer to the example executions for formatting. The isLeap Year(year) function returns true if the given year is a leap year and false otherwise. The daysInMonth(mon, year) function returns the number of days in the given month and year. Use the provided main, day Main.cpp, to demonstrate that the day Type class functions correctly The main and provided makefile reference files dayTypeImp.cpp and dayType.h. Your implementation and header files should be fully commented. dateType Class The dateType class will provide the dayType functionality with some additional functionality. Specifically, the dateType class will add support for the month names ('January', 'February', etc.) and day names ('Sunday', 'Monday', etc.). Since the dateClass will extend the basic dayType functionality, dateClass will be derived form the dayClass. The date Type UML class diagram is as follows: dateType #monthName: string #dayName: string +dateType() +dateType (int, int, int) +print FormattedDate() const: void +get MonthName() const: string +get DayName() const: string +nextDay(): void +next Day (int) : void +prevDay(): void +prevDay (int) : void +3etDate (int, int, int) : void +readDate(): void #setDateStrings(): void #getDayNumber(int, int, int) const: int Function Descriptions The following are more detailed descriptions of the required functions. The default dateType/ constructor should set the date to the current date (from the OS) and then set the date strings accordingly. The dateType/month date year) constructor should use the base class constructor but also set the date strings. Note, this means invalid dates will be set to 1/1/1970. The printFormattedDatefunction should print the date in the , , format. For example, 1/1/1970 would be: Thursday, January 1, 1970. The serDateStrings() function should set the monthName and dayName class variables with the appropriate strings based on the current integer date values. As such, any time the date is altered, the strings must be updated. The getDay Number month date, year) function return the day number 0-6 (0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc.) for either the current passed date. Refer to the provided formula. The serDate/month, date year) function should set the date to the passed values and set the date strings. If any part of the passed date is invalid, the entire date should be set to the current date (from the OS). The nextDayO and prevDay functions should use the base class functions to increment or decrement the current class date (maintained in the base class) one day. The functions must also set the date strings (via the setDateStrings() function). The nextDay(int) and prevDay (int) functions should use the base class functions to increment or decrement the current class date (maintained in the base class) by the number of days passed (changing month and/or year if necessary). The functions must also set the date strings (via the setDateStrings() function). The ger MonthName) and getDayName() functions return the strings from the corresponding class variables. The roadDate() function should use the base class function to read the date. Then, the function must also set the date strings. Use the provided main, date. Main.cpp, to demonstrate that the dateType class functions correctly. The main and provided makefile reference files date Type imp.cpp and date 7ype.h. Your implementation and header files should be fully commented calendar Type Class The calendar Type class will provide the dateType functionality (which includes the day Type functionality) with some additional functionality. Specifically, the calendar class will add support for printing a month box and an calendar for all twelve months. Since the calendar Class will extend the basic day Type functionality, dateClass will be derived form the da Class. The calendar Type UML class diagram is as follows: calendar Type +calendar Type() +calendar Type (int, int, int +printMonthBox() const: void #printYearBox() const: void Obtaining Current Date The following system calls will obtain the current date. time turl: tm local: time (&currl); local=* (localtime (currl)); // get Current time_t value // dereference and assign month = local.tm_mon + 1; date = local.ta_aday: year = local.tm year + 1900; Note, requires: #include

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

Step: 3

blur-text-image

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions