Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PAST ASSIGNMENT #include using namespace std; class Button { private: int pressC

ID: 441242 • Letter: P

Question


PAST ASSIGNMENT


#include using namespace std; class Button { private: int pressCount;//starts at 0 public: //CONSTRUCTOR Button(); //MUTATOR void Press();//increments the pressCount //ACCESSOR int TimesPressed(); }; class Date { private: int Day; int Month; int Year; public: Date(); void setDate(int y,int m,int d); void DisplayNumerically() const; void DisplayTextually() const; }; Button::Button() { pressCount = 0; } void Button::Press() { pressCount++; } int Button::TimesPressed() { return pressCount; } Date :: Date () { Year = 0; Month = 0; Day = 0; } void Date::setDate(int y, int m, int d) { Year = y; if(m < 12 && m > 1) { Month = m; } else { cout << "The month isn't 1 through 12." << endl; } if(m == 1|| m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { if(d < 31 && d > 1) { Day = d; } else { cout << "The day number is too big." << endl; } } else if(m == 2) if(d < 28 && d < 1) { Day = d; } else { cout << "The day number is too big." << endl; } else if(m == 4 || m == 6 || m == 9 || m == 11) { if(d > 1 && d < 30) { Day = d; } else { cout << "The day number is too big." << endl; } } } void Date::DisplayNumerically() const { cout << "DisplayNumerically: "; if (Month <= 12="" cout="" month="" day="" year="" endl="" void="" date::displaytextually="" const="" string="" months="" january="" february="" march="" april="" may="" june="" july="" august="" september="" october="" november="" december="" displaytextually:="" for="" int="" i="" if="" month-1="" main="" button="" mybutton="" char="" press="" created="" n="" the="" current="" pressed="" count="" of="" is="" timespressed="" do="" you="" want="" to="" y="" :="" cin="">> press; while(press!='n' && press!='N') { myButton.Press(); cout << " [myButton was pressed.] "; cout << "Now, the current pressed count of myButton is "<< myButton.TimesPressed()<< endl; cout << "Do you want to press myButton again?(y/n): "; cin >> press; cout << endl; } cout << "Now, the current pressed count of myButton is "<< myButton.TimesPressed() << endl; cout << endl; Date mydate; mydate.setDate(1992,9,2); mydate.DisplayNumerically(); mydate.DisplayTextually(); return 0; }

Explanation / Answer

plz post individual questions...!! thanks