Question: Write a complete C++ program that defines the following class: Class Salesperson { public: Salesperson( ); // constructor ~Salesperson( ); // destructor Salesperson(double q1, double

Write a complete C++ program that defines the following class: Class Salesperson { public: Salesperson( ); // constructor ~Salesperson( ); // destructor Salesperson(double q1, double q2, double q3, double q4); // constructor void getsales( ); // Function to get 4 sales figures from user void setsales( int quarter, double sales); // Function to set 1 of 4 quarterly sales // figure. This function will be called // from function getsales ( ) every time a // user enters a sales figure. This function // will also finds total annual sales. void printsales( ); // This function will be called from main( ) function to print // the total sale. Use formatted output to print the total sale up // to two decimal digits as follows: The total annual sales are: //$3679.67 void ReadFile( ); // Reads file HW7_1.txt and displays it on the //screen. void EditFile( ); // Asks the user to enter a sentence (80 characters or less) // to be added to the HW7_1.txt file. private: double sales [4]; // quarterly sales figures };

Note: 1. You should implement each member function as a separate function and test your program with the following main ( ) function. 2. Your class definition and declaration must be in separate files. (Note: Class declaration is in a file with .h extension; whereas Class member function definitions are in a file with same name as class declaration name, but extension .cpp) 3. You should also provide a constructor that can accept argument to initialize the array sales. 4. Include a destructor as well. 5. Using a text editor, create two text files called HW7_1.txt and HW7_2.txt. Each file should contain five (5) different one-line (80 characters or less) sentences. 6. void EditFile(string filename ) function should also create a third file (HW7_3.txt) consisting of the contents of file HW7_1.txt plus a sentence entered by the user. Repeat this step as many Assigned: November 15, 2018 Due Date: December 2, 2018 times as the user desires. 7. Next, void EditFile(string filename ) function should merge files HW7_2.txt and HW7_3.txt into a fourth file (HW7_4.txt). The input files HW7_2.txt and HW7_3.txt should not be of the same length at this point. 8. In the main( ), print the contents of files HW7_2.txt, HW7_3.txt, and HW7_4.txt; and a count of the letters in each file.

int main ( ) { Salesperson s, z(a, b, c, d); //values a, b, c, and d are set by the user using cout/cin. s.getsales( ); s.printsales( ); z.printsales( ); z.ReadFile( ); z.EditFile( ); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!