Question: CECS 282-05: C++ for Java Programmers Program 4- Overloading Operators Due: April 5, 2018 Create a C++ class called up Date. It should have the
CECS 282-05: C++ for Java Programmers Program 4- Overloading Operators Due: April 5, 2018 Create a C++ class called up Date. It should have the following operations: upDate()- default constructor. This will set the date to May 11, 1959 (A very important date!!) . upDate(int M, int D, int Y)-overloaded constructor. This will set the date to the values passed in through the parameter list represented by Month, Day and Year. If any one of the parameters is out of range, the date is set to the default date. upDate( int J)-overloaded constructor-create a date using the Julian date upDate()-destructor. Be sure to de-allocate any memory that was allocated in the constructor void setDate(int M, int D, int Y) - works just like the constructor . int getMonth) - return the month in integer form . int getDay()- return the day of the month . int getYear()- return the year . string getMonthName() - return the name of the month Add the necessary class methods (functions) to support the following upDate DI(10,27,2010): 1/ overloaded constructor . upDate D2(D1) // copy constructor // assignment operator // add 5 days to D1, result is stored in D1 // subtract 7 days from DI, result is stored in D1 D1-D2; D1 += 5; D1--7 upDate D3 D2+5; // add 5 days to D2, assign result to D3 upDate D4-5+ D2; // add 5 days to D2, assign result to D4 upDate D5 D2-4; // subtract 4 days from D2, assign result to D5 intx -D5-D4; // days between D5 and D4. Can be negative or positive cout D2) Additional reguirements: You MUST create a pointer in the private data members that points to an integer array. When you create an upDate object (using the constructor) you must dynamically allocate an array of three integers-the Month, Day and Year. Write a driver program that tests each operation. I will provide a test program to you before the due date
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
