Question: Programming 2 (C++) Please write the code clearly or take a photo from the compiler Define a class called Person with private members first, and

Programming 2 (C++)
Please write the code clearly or take a photo from the compiler
Programming 2 (C++)Please write the code clearly or take a photo from
the compiler Define a class called Person with private members first, and
last both of type string. The class also has the public member
functions set), print(), getFirstName(), getLastName 0, and a default parameterized constructor. Define

Define a class called Person with private members first, and last both of type string. The class also has the public member functions set), print(), getFirstName(), getLastName 0, and a default parameterized constructor. Define a class called Product with private members name, code both of type string, price, quantity both of type integer, and the function calculate Cost() which calculates the cost of a product (price * quantity). The class also has the public member functions set(), print(ofstream\&), getNameO, getCode 0 , getPrice0, getQuentity0, and a default parameterized constructor. Define a class called Selasperson that publicly inherits the class Person. The class has the private members Id, numberOfProducts both of type integer, salary of type double, productsSola[ ] (an array of type Product and size maxStze =10 ), and the member function calculateSalary0). The class also has the public members set(ifstream\&), print(ofstream\&), and getSalary 0 . The salary is calculated as 6% of the sum of price "quantity of all products sold. Implement all member functions of the three classes, enforcing the least privileged principle. The following driver produces the given sample of output: ifstream inFile("productin txt", ios::in); ofstream outFile("productOut.txt", ios::out); int main0 \{ Salesperson salespersonsList[10]; int i, noOfSalespersons; inFile noOrSalespersons; ifstream inFile("productin.txt", 10s::in); ofstream outFile("productOut.txt", ios::out); int main 0 \{ Salesperson salespersonsList[10]: int i, noOfSalespersons: inFile noOfSalespersons; for (i=0;i

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!