//P11 SalesPerson - Juan Marquez TR 1:00pm/* This program is a driver to test the SalesPerson class. It is used to create 2 objects, which test the constructors and accessors. The objects created are saved to p11.txt.*/#include <fstream> // file processing#include <iostream> // cin and cout#include <iomanip> // setw#include <string> // string classusing namespace std;//Copy-and-paste your class definition from P10.cpp.//P10 SalesPerson class - Aaron Harper TR 1:00pm#include <string> // string classusing namespace std;//Class definition - the interface for the class class SalesPerson{private:int salesPersonId;string firstName, lastName;public://Default constructorSalesPerson();//Overloaded constructorSalesPerson(string f, string l, int i); //Destructer~SalesPerson();//accessorsvoid setfirstName(string f);void setlastName(string l);void setsalesPersonId(int i);string getfirstName(); string getlastName();int getsalespersonId(); void inputfirstName();void inputlastName();void inputsalesPersonId();};//Class definition - the interface for the classclass SalesPerson{private:public:};//Application Starts here (prototypes, main(), and defintions for application)//saves info to a file or displays to screen (cout) through ostream& parametervoid outputSalesInfo(ostream& target, SalesPerson& salesPersonObj); //main driver to test SalesPerson classvoid main(){//Open the file for output; if there are any errors, we need to //display an error message. ofstream fileOut; fileOut.open(" P11.txt"); if (fileOut.fail()) { cout << "Error opening output file for sales information.\n" << "Exiting program \n\n"; return; }//Change instructor's name to your name throughout cout << "\nP11 Juan Marquez TR 1:00pm \n\n";//1001 Joe Smith - use default constructor and input functions SalesPerson salesPersonObj; //Save the validated sales info data as a record to the file. outputSalesInfo(fileOut, salesPersonObj);//display the record on the screen outputSalesInfo(cout, salesPersonObj);//1002 Larry Jones - use set functions to change values. salesPersonObj.setSalesPersonId(1002); salesPersonObj.setFirstName("Larry"); salesPersonObj.setLastName("Jones");//Save the sales info data as a record to the file. outputSalesInfo(fileOut, salesPersonObj); //display the record on the screen outputSalesInfo(cout, salesPersonObj);//1003 Paul Sailor - use overloaded constructor SalesPerson salesPersonObj2(1003, "Paul", "Sailor"); //Save the sales info data as a record to the file. outputSalesInfo(fileOut, salesPersonObj2);//display the record on the screen outputSalesInfo(cout, salesPersonObj2);// Close the output file and exit program fileOut.close(); return;}//end of main//save the order information to a file or display to screen.//target can be either cout or fileOut because ofstream inherits ostream.//ofstream objects are also ostream objects. //also, must be ostream because cout is already declared as an ostream.void outputSalesInfo(ostream& target, SalesPerson& salesPersonObj){//declare local variables int salesPersonId; string lastName, firstName;//Have the class return the private values to the local variables.//Then store them in the file. salesPersonId = salesPersonObj.getSalesPersonId(); firstName = salesPersonObj.getFirstName(); lastName = salesPersonObj.getLastName(); if(target == cout) target << "\n\nSales Person's Information Saved! \n"; target.setf(ios::left); target << setw(6) << salesPersonId << setw(18) << firstName << setw(18) << lastName << endl; target.unsetf(ios::left); return;}//Student must complete the constructors, set and get accessors,//and input function definitions. A total of 11 functions.//The default constructor should call the 3 input functions. //Destructor functionSalesPerson::~SalesPerson(){ cout << "\nSalesPerson Object going out of scope. Id = " << salesPersonId << endl; return;}