Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please help using C++ language 3. In the following program an employee of a company is represented by an object of type employee

image text in transcribedimage text in transcribedCould you please help using C++ language

3. In the following program an employee of a company is represented by an object of type employee consisting of a name, employee id and employee salary. The class employee has methods read() and write(). Information about a company's workforce is stored in an object of type workforce consisting of the workforce size and a vector employees of that same size. The methods read() and write() are defined for workforce. Do not modify the main program. Complete the program by writing the read and write methods for the class workforce. The constructor must create a vector of employees. For marking purposes, use the input file workforcein.txt Declaration of Employee and Workforce Classes File: workforce.h An employee's information is stored as an object of type employee consisting of name, employee id and employee salary. The methods read() and write are defined for employee. Information about a company's workforce is stored in an object of type workforce consisting of the workforce size and a vector of employees of that size The methods read() and write () are defined for workforce. and write() The read() and write () methods for workforce use the read methods for employee */ #ifndef WORKFORCEH #define WORKFORCE H #include #include #include #include using namespace std; class employee { private : string name; // last name int id : // employee id number float salary: // employee salary public: employee ( string n = "nobody", int i = 0, float s = 0); void read (istream & in); void write (ostream & out) const; class workforce { private : int size; vector list; // size of workforce // vector of employees public: workforce (int n); // set size = n void read (istream & in); void write (ostream & out) const; }; #endif /* WORKFORCE H */ Implementation of Employee and Workforce Classes /* File: workforce.cpp Implementation of classes employee and workforce */ #include "workforce.h" ////////////////////// implementation of employee //////////////////////// employee :: employee (string n, int i, float s) name = n; id = i; salary = s; void employee :: read (istream & in) in >> name >> id >> salary: void employee :: write (ostream& out) const out

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions