Question

Design a class named Employee having data members for employee ID, employee name, and
monthly salary. Implement member functions to

08 Aug 2026
Answer :
Word Count : 874
A class named `Employee` can be designed in C++ to represent the basic information of an employee, such as employee ID, employee name, and monthly salary. The class can contain private data members to protect the employee information from direct access outside the class. Public member functions can then be used to initialize, modify, and display the employee details. Encapsulation, one of the important principles of object-oriented programming, is achieved through this arrangement. The employee ID can be stored using an integer data type, while the employee name can be stored using the `string` data type. Since salary may contain decimal values, it is appropriate to use `float` or `double`. The `double` data type is generally preferred because it provides greater precision for monetary calculations. A suitable implementation of the `Employee` class is as follows: ```cpp #include #include using namespace std; class Employee { private: int employeeID; string employeeName; double monthlySalary; public: void getData() { cout > employeeID; cin.ignore(); cout > monthlySalary; } void displayData() { cout ______ _______ _____ ___ ________.
______ _________ ___ ________ _________ _____ _______ ______ _________.
_______ ______ ____ ___ ___ ______.
___ _______ ___ ________ ______ _____ _______ ______ ____ _______ ____.
______ ________ _____ ___ ____ ____ ________ _______ ____ _______.
__________ _________ ______ ________ _______ _________ ____.
_________ ________ ______ _______ ________ _________ ____ _______ ______ _________.
__________ ___ ____ ________ _________ _____ ______ _______ _______ ______ ___.
_______ ______ ______ ___ ______ __________ ____ ____ _________ ________.
_____ _______ _____ ________ ________ __________ ______ ____ __________ ________.
___ ________ _______ ___ ____ ____ _____ ________ _________.
______ _____ _____ _______ _________ _________ _________ _____ ________.
______ __________ _____ _________ ________ _________ ___ ________ __________.
________ _____ _______ ______ ___ __________ _________ ____ _________ _______ _____ ____.
__________ _________ ________ _______ _____.
_________ __________ _____ ____ ______ ____.
______ ________ ______ _________ ______ __________ __________.
______ _____ _________ _______ _____ ____ _________.
_____ __________ ________ ________ ______ ____ _____ ___ _______ _______ _____.
___ ____ __________ ___ _____ _____ ________ __________ _________ ___ ________ ___.
_______ ___ _____ _________ ______ __________ ____.
_____ _____ __________ ________ ____ ________ ____.
_____ ____ __________ ____ _________ ________ _________.
______ __________ _________ ______ __________ ___ ______ _____ _____.
_____ ___ _________ ____ __________ _________ _______ __________.
_________ ____ ____ _________ _____ ____ __________ _________ _________ _____ ___.
_______ _____ ______ _________ ____ _____ ___ __________ _____ ____ _________.
________ _______ __________ _____ _________.
____ _________ ___ ____ _______.
______ __________ ________ __________ _________ _________ ___ ____ __________ _____.
___ ____ __________ _______ ____ _____ _________ ______.
________ ________ ________ _________ __________ _________ ______ ______.
____ __________ ____ ____ _______ __________ ___ _____.
_________ _______ __________ ________ ________ _________ _______ _________ ____ ________ __________ _____.
_____ _____ _________ _______ _______ _________ ____.
__________ ____ _______ ____ __________ ____ ___ ________ ____ ___ ____ ____.
_________ ____ _________ ___ __________ ____.
____ _________ ___ ___ ____ ____ ___ _______ _____.
___ _______ _______ _____ _____ __________ ________ _____ ____ ____ _____ ________.
______ __________ ______ ____ _________.
________ _______ ______ _________ ____ __________ _____ _________ _____ __________ _____ ___.
____ __________ ______ ______ ________ ______ ___.
____ _____ ___ ___ _____ __________ ________.
________ ___ ________ _____ _______ ____ __________ _________ __________ ______ ________ __________.
__________ ___ _________ ______ ____ ________.
_____ ____ _____ _____ _________ ___.
___ ______ ____ ________ __________ ____ _____ ______ ___.
_________ ____ ____ ___ ________ _______ _________ ___ __________.
_____ __________ _________ _____ _____ ______ ________ _________ ______ ______.
___ ____ _____ ___ ________ _________ _____ ____ _________ _______ _____ ______.
______ ___ _______ ______ __________.
______ ______ _______ ______ ____ _________ _____ ___ ___.
_________ __________ _______ _________ _____.
______ ________ ________ _____ _________ _________ ____ _________ ____.
_____ _________ _________ _____ _________ ____ _____ __________ ______ _________.
___ ____ _________ ___ _______ _________ __________ ___ _________.
_______ ________ ________ _______ _________ ________ ________ ___ ___ ___.
______ __________ ___ ________ ________.
__________ _________ _________ ___ _______ ____ ________ ___ ____.
____ ________ _________ _______ _______ ____ _____ ______ ___.
________ ___ _________ ____ _____ ________ _____ _____ _________.
_________ ______ __________ ______ _______ _________.
______ ______ ______ __________ ___ _______ ___ _________ ____.
_________ ________ ___ ____ ___ _____ ___ ___.
_____ _____ _______ _____ __________ _________ ______ ________ ______ _______ __________ ____.
_____ ___ ________ ___ _________ ________ __________ _____ _________ _________ _____.
______ ______ ___ _________ _____ ______ ____ __________ ___ ______ _______.
__________ _________ ____ ________ ______ _______ _______ ______.
_____ _______ __________ ____ ___ ______ _____ __________ _______ ____ __________ _________.
_____ ________ __________ ____ ___ _____ __________ ________ ________ _________.
___ ______ ____ ______ ____ ____.
____ _________ _______ _______ _______ _______ ______ ______ __________ _________ _____ _______.
_____ ________ _________ ____ ___ ____.
_____ _______ _____ _____ ____ _______ _____ ________.
______ _____ _______ ______ __________.
Get Full Answer on WhatsApp
IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Design a class named Employee having data members for employee ID, emp
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→