Question: C++ programming. Please follow the requirements and show a screenshot of the output. Fig 10.3, 10.4, and 10.5 are attached below. Requirements This program demonstrates
C++ programming. Please follow the requirements and show a screenshot of the output. Fig 10.3, 10.4, and 10.5 are attached below.





![class should include the following member data: private: char phone[15]; // holds](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31d8e3c559_84566f31d8dada77.jpg)
Requirements This program demonstrates overloaded stream operators. Supply appropriate interaction (input/output) with your user. Again, provide appropriate interaction (input/output) with your user. Begin with code Fig. 10.3, Fig. 10.4, and Fig. 10.5. Modify that code as follows. The PhoneNumber class should include the following member data: private: char phone[15]; // holds entire phone number plus \0 char areaCode[4]; // holds area code plus \0 char exchange[4]; // holds exchange plus \0 char line[5]; // holds line plus \0 Rewrite the overloaded extraction operator to include the following: 1. Phone number should be entered of the form: (888) 5551234 2. Input the entire phone number (from user) into the phone[] character array. 3. Test that the correct number of characters (14) have been entered. 4. Test that the area code and exchange do not begin with 0 or 1 . 5. Set the fail bit using "input.setstate(ios::failbit)" if an error condition is encountered. If the fail bit has been set then message that an invalid phone number has been entered and ask your user if s/ he would like to enter another phone number. If the fail bit has NOT been set then copy the appropriate parts of the phone[] array into the PhoneNumber object data members. Output the PhoneNumber object data members and other relevant information to your user. Include the following at the end of main() to provide a graceful exit: cin.ignore(numeric_limits::max(), ' ); cin.clear(); cout to exit: "; cin.get(); Fig. 10.3 PhoneNumber class with overloaded stream insertion and stream extraction operators as friend functions. Fig. 10.4 | Overloaded stream insertion and stream extraction operators for class PhoneNumber. (Part I of 2.) Fig. 10.4 | Overloaded stream insertion and stream extraction operators for class PhoneNumber. (Part 2 of 2.) Fig. 10.5 Overloaded stream insertion and stream extraction operators. (Part I of 2.) Enter phone number in the form (555) 555-5555: (800) 555-1212 The phone number entered was: Area code: 800 Exchange: 555 Line: 1212 (800) 555-1212 Fig. 10.5 Overloaded stream insertion and stream extraction operators. (Part 2 of 2. )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
