Question: In this exercise, you complete a program that uses the FormattedDate class shown in Figure 15-1 in the chapter. Follow the instructions for starting C++

In this exercise, you complete a program that uses the FormattedDate class shown in Figure 15-1 in the chapter. Follow the instructions for starting C++ and viewing the TryThis8.cpp file, which is contained in either the Cpp8\Chap15\TryThis8 Project folder or the Cpp8\Chap15 folder. (Depending on your C++ development tool, you may need to open this exercise’s project/solution file first.) In the TryThis8 FormattedDate.h header file, enter the #include and using namespace std; directives. Then enter the class definition from Figure 15-1. Next, complete the TryThis8.cpp file by entering the appropriate instructions. Use the comments as a guide. Test the program appropriately.

Syntax // declaration section class className { public: public attributes (data members) public behaviors (member methods) private:- private attributes (data members) private behaviors (member methods) colon colon semicolon //implementation section member method definitions] Example T/ declaration section class FormattedDate { public: FormattedDate();- FormattedDate(string, string, string); void setDate(string, string, string); string

Syntax // declaration section class className { public: public attributes (data members)

Syntax // declaration section class className { public: public attributes (data members) public behaviors (member methods) private:- private attributes (data members) private behaviors (member methods) colon colon semicolon //implementation section member method definitions] Example T/ declaration section class FormattedDate { public: FormattedDate();- FormattedDate(string, string, string); void setDate(string, string, string); string getFormattedDate (); private: method prototypes string month;- string day; string year; variable declarations }; //implementation section FormattedDate::FormattedDate(O { //initializes the private variables month = "0"; day - "0"; year = "0"; } //end of default constructor FormattedDate: FormattedDate(string m, string d, string y) { //initializes the private vari ables //using the values provided by the program month = m; day = d; year = y; } //end of default constructor void FormattedDate:: setDate (string m, string d, string y)

Step by Step Solution

3.44 Rating (179 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 TryThis8cpp displays a formatted date 2 Createdrevised by on 3 4 include 5 include 6 include TryTh... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related An Introduction Programming Questions!