Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

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

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago