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

What am I doing wrong???? { animate( \"dateObj reference declared\" ); /***** Ad

ID: 440321 • Letter: W

Question

What am I doing wrong???? { animate( "dateObj reference declared" ); /***** Add your code here *****/ SimpleDate dateObj; /**** 1. Instantiate dateObj using an empty argument list */ dateObj = new SimpleDate (); //animate( "Instantiated dateObj - empty argument list" ); /***** 2. Set the month to the month you were born */ SimpleDate birthmonth = new SimpleDate (1); //animate( "Set month to birth month" ); /***** 3. Set the day to the day of the month you were born */ SimpleDate birthday = new SimpleDate (22); //animate( "Set day to birth day" ); /***** 4. Set the year to the year you were born */ SimpleDate birthyear = new SimpleDate (1989); //animate( "Set year to birth year" ); /***** 5. Call the nextDay method */ dateObj.nextDay(); //animate( "Set the date to the next day" ); /***** 6. Set the day to 32, an illegal value */ birthday.setDay(32); //animate( "Set day to 32" ); /***** 7. Set the month to 13, an illegal value */ birthmonth.setMonth(13); //animate( "Set month to 13" ); /***** 8. Assign the value null to dateObj */ dateObj = null; //animate( "Set object reference to null" ); /***** 9. Attempt to set the month to 1 */ SimpleDate birthmonth = new SimpleDate (1);

Explanation / Answer

you do not need to take three objects of same class type . as we can take three data members in class i.e. day, month, year and instantiate only one object date and set day month and year of that object. here is code: class SimpleDate{ int day; int month; int year; public: SimpleDate() { day=0; month=0; year=0; } void setDay(int d) { if(d>=1 && d=1&&m
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote