Question: #include #include using namespace std; class Employee { /* 3. Create a class called 'EMPLOYEE' that has -private fields: write integer empcode and char empname

#include #include using namespace std;

class Employee { /* 3. Create a class called 'EMPLOYEE' that has -private fields: write integer empcode and char empname with array size 10 as data members -public methods: write a void member function getdata() to input data and void member function display() to output data */

};

void Employee::getdata() { cout << " NAME :"; cin >> empname; cout << " CODE :"; cin >> empcode; }

void Employee::display() { cout << endl << setw(20) << empname << setw(10) << empcode << endl; }

/* 4. Write a main function to create EMP, an array of EMPLOYEE objects. Accepts and display the details of at least 6 employees. */

int main() { //Write Employee class to create Emp array size of 6 below:

cout << "Enter employee details: "; for (int i = 0; i < 6; i++) { cout << " employee " << i + 1 << endl; //Use the Emp object array to access the getdata method, write the content of the Emp array using the getdata() method below

} cout << " Employee details are as follows :"; cout << " " << setw(20) << "NAME" << setw(10) << "CODE"; cout << " --------------------------------"; //Display each of the Emp array by accessing the display method below.

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!