Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment will demonstrate your understanding of the following: 1. C++ classes, 2. Implementing a class in C++; 3. Operator overloading with chaining: 4.

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
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
In this assignment will demonstrate your understanding of the following: 1. C++ classes, 2. Implementing a class in C++; 3. Operator overloading with chaining: 4. Preprocessor directives #ifndef, #define, and endir 5. this - the pointer to the current object. In this assignment you will implement the Date class and test its functionality. Consider the following class declaration for the class date: class Date public: Date(); //default constructor sets -et, d-a1, y-2001 Date(unsigned unsigned d, unsigned y); //explicit value constructor to set date equal to today's 1/date. Use 2-digits for month (a) and day (), and 4 acts for yearly): This function should 1/print a message if a leap year. void display() //output Date object to the screen int Betonths/accessor to output the month Ant getDayOil/accessort output the day int get Year();//accessor to output the year void setMonth(unsigned );//autator to change the month void set Dayunsigned d)://mutator to change the day vold setyear(unsigned );//mutation to change the year friend astra & sperator Bete conti // te testen, wie con Motor 18 le teilyt recondition CONDITION > // vold display > Posts > co //Postendit // Ettery ru > Post //escrit Integrert > 1/ Precon Postco escrit Descript 1/ 11 walay > escrit > ORTVERE Courie, rest w we analysis to write Du Duterte De here, 5.39533 De tests. 1.2 De test202.23. 2000): Duta testet. 2003) should rewrow that Dute testate 1.25, terra terte.at Gate cochote // // Precondition // Postcondition: //Description // vold Date setYear(unsigned stream& operatocostra & out, Date date) DATE DRIVER.C //EXAMPLE OF PROGRAM HEADER N: 2: Course Date Structures and Algorithm Analyst (COP353) Professor: tir. Lofton Bullard Due Date: Due Time Total Point 10 Assignment 3: Date program Description int in Date myoate Date herDate(13, 14, 1953); Date test1Date(25, 1, 1982); //should cererate error message that bad month Date test22Datet 3. 23, 2930)should say 1 year Dute testate(2. 30, 2001); // shoulderte error message that had day Date testate (1.25,4060): I/should rate error message that bad year nate testate(80,40,0000); //should generate error message that bad month day and year herbate.display: coutscher Date.getMonth()sendl; cout In this assignment you will implement the Date class and test its functionality. Consider the following class declaration for the class date: class Date public: Date(); //default constructor; sets .01, d-01, y=0001 Date(unsigned m, unsigned d, unsigned y); //explicit-value constructor to set date equal to today's /date. Use 2-digits for month (m) and day (d), and 4-digits for year (y); this function should 1/print a message if a leap year. void display();//output Date object to the screen int getMonth();//accessor to output the month int getDay();//accessor to output the day int getYear();//accessor to output the year void setMonth(unsigned m);//mutator to change the month void setDay (unsigned d); //mutator to change the day void setYear(unsigned y);//mutation to change the year friend ostream& operator #include #include //#include "date." using namespace std; //********* //***** DATE. 7/This declaration should go in date.h #ifndef DATE M #define DATE_H class Date public: Date(); //default constructor; sets mee, d-01, y -2001 Date(unsigned m, unsigned d, unsigned y); //explicit value constructor to set date equal to today's 1/date. Use 2-digits for month (m) and day (d), and 4-digits for year (y); this function should //print a message if a leap year. void display();//output Date object to the screen int getMonth();//accessor to output the month int getDay();//accessor to output the day int getYear();//accessor to output the year void setMonth(unsigned m);//mutator to change the month void setDay(unsigned d); //mutator to change the day void setYear(unsigned y); //mutation to change the year friend ostream& operatorc 1/ 7/Note: Date 1/Precondition: Postcondition: //Description: //*** Date::Date(unsigned m, unsigned d, unsigned y) } 1/***** /Name: Display //Precondition: 1/Postcondition: //Description: 1/ // W******* void Date::display() } 7/Name: get Month // Precondition: /Postcondition: 1/Description: 1/ int Date::getMonth) int Duter.getMonth() { return a; // Name: getDay 7/Precondition: //Postcondition //Description: // //***** int Date::getDay() { return 1; ***** // Name: getYear Precondition: // Postcondition: //Description: W 17 ***** int Date::getYear() return 1; /Name: Set Month /Precondition: //Postconditions 1/Description: int Date::getDay return 1: 3 //***** 1/Note: getYear 1/Precondition: //Postcondition: v/Description: W // int Date::getYear() return 1; 3 //***** //Name set Month Y Precondition: // Postcondition 1/Description 1/ 17 //******* void Datenset Month(unsigned ) ) //**** // Name: set Day 1/Precondition //Postcondition 1 /Description: w 17 void Date:coetbay (uns fined int Date::getYear() Hes return 1: . // Name: set Month //Precondition: 7/Postcondition: 1/Description: // //**** void Date::set Month(unsigned ) } //***** /Name: setDay V/Precondition: //Postconditions //Description: // //******* void Date::setDay(unsigned d) > /*** /Nase getYear 1/Precondition: //Postcondition: //Description: // //******** void Date: set Year(unsigned y) 3 // 17/ void Date::set Year(unsigned y) { } ostream& operator

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

Students also viewed these Databases questions

Question

What lessons in OD contracting does this case represent?

Answered: 1 week ago

Question

Does the code suggest how long data is kept and who has access?

Answered: 1 week ago