Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need the answer of qeustion 10 please in c++ language 1 In Programming Exercise 2, the clea datelype was designed and implemented to keep
i need the answer of qeustion 10 please in c++ language
1 In Programming Exercise 2, the clea datelype was designed and implemented to keep track of a date, but it has very limited operations. Redefine the clase datelype so that it can perform the following opera- tions on a date, in addition to the operations already defined Set the month Set the day Set the year. d Return the month Return the day. Return the year Test whether the year is a leap year h Return the number of days in the month. For example, if the date is 3-12-2019, the number of days to be returned is 31 because there are 31 days in March 814 Chapter 11: Inheritance and Composition Return the number of days passed in the year. For example, if the date Is 3-18-2019, the number of days passed in the year is 77. Note that the number of days returned also includes the current day Return the number of days remaining in the year. For example, if the date is 3-18-2019, the number of days remaining in the year is 288 E Calculate the new date by adding a fixed number of days to the date. For example, if the date is 3-18-2019 and the days to be added are 25, the new date is 4-12-2019. 1. Write the definitions of the functions to implement the operations defined for the clean datype in Programming Exercise 6. The clandetarype defined in Programming Exercise 6 peints the date in numerical form. Some applications might require the date to be printed in another form, such as March 24, 2019. Derive the class extDataType so that the date can be printed in either form. Add a member variable to the class extDataType so that the month can also be stored in string form. Add a member function to output the month in the string format, followed by the year-for example, in the form March 2019 Write the definitions of the functions to implement the operations for the class extDateType. 1 Using the claunes extDateType (Programming Exercise 8) and dayType (Chapter 10. Programming Exercise 5), design the clue calendar Type so that, given the month and the year, we can print the calendar for that month. To print a monthly calendar, you must know the first day of the month and the number of days in that month. Thus, you must store the flest day of the month, which is of the form daytype, and the month and the year of the calendar. Clearly, the month and the year can be stored in an object of the form extDataType by setting the day component of the date to 1 and the month and year as specified by the user. Thus, the clus calendar Type has two member variables an object of the type duyype and an object of the type extDateType. Design the clasalandasType so that the program can print a calendar for any month starting January 1, 1500. Note that the day for January 1 of the year 1500 is a Monday. To calculate the first day of a month, you can add the appropriate days to Monday of January 1, 1500 For the class calendar Type, include the following operations: Determine the first day of the month for which the calendar will be printed. Call this operation firstDayOfromth Set the month. Set the year. Programming Exercises 815 d Return the month. Return the year E Print the calendar for the particular month. Add the appropriate constructors to initialize the member variables. 10. Write the definitions of the member functions of the class calendar Type (designed in Programming Exercise 9) to implement the operations of the class calendarsype. Write a test program to print the calendar for either a particular month or a particular year. For example, the calendar for September 2019 is: September 2015 Sun Hom Wed Tui Sat 1 2 4 5 a 9 10 11 12 13 16 17 18 19 21 22 23 24 25 25 28 23 30 13 20 27Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started