Question
IN C++ PLEASE>>> Design and code a class that represents a single month of the year. It should have a single integer-typed data member to
IN C++ PLEASE>>> Design and code a class that represents a single month of the year. It should have a single integer-typed data member to represent the month. Make sure to provide proper construction, access, and mutation for this member as well as input and output methods. In addition, methods for comparing two months chronologically for ordering would be useful as would a method to advance to the next month (note that January follows December and begins the cycle anew) or previous month. In fact, thinking about it, it might be good to be able to advance to a month an arbitrary number of whole months in the future or past: January '+' 5 = June; March '-' 5 = November. Place your Month class in a library. Write a test application (driver) for your class. Oh, and the programmers who commissioned this class wanted to make sure it could handle not only integer-valued representation of a Month but also either whole-word names or three-letter abbreviations for the Months. That means that they should be able to construct a Month object from either an integer value or a string -- which could be either the whole month name or a 3-letter version there-of. Similarly, they'd like to be able to retrieve the Month's information as either an integer value or a string (of either form), mutate the Month by any of these means, display by any of the three forms, and even allow their user to enter any of the three forms at the console. But, to keep things as simple as possible, they'd not like a whole lot of different names to remember. Please use the following names for all functions that perform such tasks: set_month, get_month, input, output, advance, before, after, same. (There may be only one of some methods, but others may need at least two methods to offer all requested functionality.)
Step 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