Question
c++ class make sure put comments please In this program, you will manage employees in a company. You will design a C++ class called Employee.
c++ class
make sure put comments please
In this program, you will manage employees in a company. You will design a C++ class called Employee.Objects of employee class have 5 attributes such as Employee ID, Employee Name, Department ID, Department Name, and Salary. In your Employee class, you should declare the member variables private. You will implement set/get functions for each attribute. Also, you should have at least one constructor function. Finally, it would be helpful if you have a public print() function to print the employee info on the screen.
Once your class is ready, you will read the employees.txt file, which includes all employees in the company. A sample view of the file is given below:
The first line of the file shows how many employees exist in the company. After reading this file, you will dynamically allocate an array of employees for that exact number. The employees.txt file may be in different size. It does not have to be 100 as shown above example.
Starting from the second line, each line contains a single employee information. You can read the rest of the file using a while loop. In each iteration, you will fill one element of the employee array.
Once your employee array is ready, you will provide following operations to the user in a menu.
1) Print All Employees
a. Print all information of all Employees
2) Print By Department
a.Get an input from the user (department ID)
b.Print all information only for employees in that department
3) Print By Salary
a. Get a salary input from the user
b. Print all employees that have equal or more annual salary to given input
4) Update Salary
a.Get an employee ID from the user
b.Get the new salary from the user
c.Update the salary of that employee
5) Save to the File
a. Save the current version of the employee array to the employees.txt file
6) Exit
a. Exit from the program
employees.txt
100 1 Kasimir 4 Marketing 145000 2 Iona 2 RD 37000 3 Iliana 1 Production 141000 4 Gage 1 Production 64000 5 Ira 4 Marketing 121000 6 Cameron 3 Purchasing 137000 7 Xander 3 Purchasing 125000 8 Amal 2 RD 72000 9 Lamar 2 RD 125000 10 Daniel 4 Marketing 59000 11 Petra 2 RD 43000 12 Alec 5 HR 57000 13 Lewis 5 HR 94000 14 Lillian 3 Purchasing 26000 15 Zeph 1 Production 105000 16 Ciaran 3 Purchasing 55000 17 Evan 3 Purchasing 112000 18 Iola 5 HR 73000 19 Jada 3 Purchasing 147000 20 Elijah 3 Purchasing 95000 21 Medge 3 Purchasing 31000 22 Ian 4 Marketing 134000 23 April 1 Production 126000 24 Kiara 4 Marketing 91000 25 Castor 3 Purchasing 23000 26 Alana 5 HR 79000 27 Lucy 5 HR 65000 28 Farrah 3 Purchasing 72000 29 Eagan 1 Production 142000 30 Iola 4 Marketing 67000 31 Jessica 2 RD 33000 32 Eliana 5 HR 74000 33 Donna 3 Purchasing 120000 34 Alden 2 RD 119000 35 Paul 4 Marketing 141000 36 Hector 4 Marketing 90000 37 Ignatius 2 RD 26000 38 Allen 2 RD 146000 39 Diana 1 Production 132000 40 Willa 4 Marketing 65000 41 Ulla 3 Purchasing 54000 42 Alea 2 RD 96000 43 Althea 5 HR 143000 44 Elaine 2 RD 98000 45 Kelly 5 HR 29000 46 Karyn 4 Marketing 71000 47 Hyatt 2 RD 62000 48 Madonna 1 Production 73000 49 Channing 4 Marketing 38000 50 Darius 5 HR 144000 51 Raya 5 HR 23000 52 Lareina 1 Production 86000 53 Sydney 4 Marketing 82000 54 Benjamin 2 RD 91000 55 Martin 4 Marketing 79000 56 Beck 1 Production 65000 57 Paula 2 RD 118000 58 Grace 4 Marketing 33000 59 Camille 5 HR 140000 60 Briar 1 Production 124000 61 Dorothy 5 HR 28000 62 Aquila 2 RD 149000 63 Prescott 2 RD 125000 64 Dana 2 RD 82000 65 Hedwig 2 RD 53000 66 Mira 5 HR 138000 67 Uma 2 RD 61000 68 Ciara 4 Marketing 98000 69 Yuri 5 HR 139000 70 Hector 1 Production 35000 71 Edan 1 Production 44000 72 Callum 3 Purchasing 65000 73 Phoebe 4 Marketing 49000 74 Preston 3 Purchasing 69000 75 Chanda 2 RD 137000 76 Larissa 2 RD 115000 77 Warren 4 Marketing 116000 78 Orlando 4 Marketing 124000 79 Sandra 4 Marketing 57000 80 Kevyn 5 HR 147000 81 Jasmine 3 Purchasing 43000 82 Candice 3 Purchasing 110000 83 Hanna 5 HR 21000 84 Cheryl 2 RD 101000 85 Jasmine 5 HR 48000 86 Lisandra 3 Purchasing 141000 87 Odysseus 2 RD 53000 88 Marshall 4 Marketing 100000 89 Amena 1 Production 87000 90 Christian 3 Purchasing 146000 91 Charles 4 Marketing 44000 92 Julian 2 RD 123000 93 Solomon 5 HR 144000 94 Ava 5 HR 142000 95 Jin 5 HR 142000 96 Donovan 3 Purchasing 110000 97 Chava 1 Production 108000 98 Clark 4 Marketing 107000 99 Jocelyn 4 Marketing 24000 100 Leilani 4 Marketing 105000100 1 Kasimir 4 Marketing 145000 2 Iona 2 RD 37000 3 Iliana 1 Production 141000 4 Gage 1 Production 64000 5 Ira 4 Marketing 121000 6 Cameron 3 Purchasing 137000 7 Xander 3 Purchasing 125000 8 Amal 2 RD 72000 9 Lamar 2 RD 125000 10 Daniel 4 Marketing 59000 11 Petra 2 RD 43000 12 Alec 5 HR 57000 13 Lewis 5 HR 94000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started