Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I do these 3 tasks for my C++ in a Unix Environment class Thank You Warning: You should not use system(...) function call

How do I do these 3 tasks for my C++ in a Unix Environment class

Thank You

image text in transcribed

image text in transcribed

Warning: You should not use "system(...)" function call throughout this assignment. Note. You may use some sample code provided (see below) for this part. Design and implement a C++ program (a3part3.cpp) with the password file (ets/passwd) to do the following tasks Note. To compile a C++ program, use g++. If you use gcc, use: -lstds+option gcc hello.cpp -o hello -lstds+ Source: https:gcc.gnu.org/projects/cxx-status.html You need to make a file (emp.txt) which contains its employee records as listed below. Each line represents one employee record. Each employee record consists of 7 fields of each employee's: (1) empleveetR. (2) emplouseName (3)pployee Roa tion (4) smplexeeDeRattmeat (5) emplo eemt Rat and (6) employee alan Each field is separated by a colon ("-"). :director :marketing 09/26/45 125000 :dgmaccounts 12/12/55: 85000 3564:ronie tremble:executive:personnel :07/06/47 75000 2345: 3 www.am3 :g.m. :marketing :03/12/45:110000 :12/12/52: 90000 9876:bill richardson :director :production: 03/12/50:130000 5673 robert daren d ammarketing :04/19/43: 85000 :director :personnel :05/11/47:120000 :08/30/56:160000 :09/03/38:140000 6213 michael lebron g.macunts :06/05/62:105000 :09/12/63: 90000 :executive:production: 09/07/50 65000 :05/01/59:110000 6521:derrvk luke 3212 :bill paper 233:charles honey m : sales 365 : ohn wood 5423:barry wilsom: chairman :admin 1006:qordon light :director sales 1265: 4290 neil osbOn house :manager ales 476:iackie wode :manager sales Design and implement a C+t program to do the following tasks. Task #1. Design and implement a class of "employee" with constructor and destructor, with member variable for each field, and method for get and set each field, and instantiate each employee object from each record read from emp.txt" file, and output each instance of employee object to a file "emp2.txt" file in the following format. Output each record to "emp2.txt file" Record #1 ID=2233 Name=charle ham . Position-gm Departmensales BiuthDate 12/12/52 Salary 90000 and so on. Task #2. Design and implement one C++ static variable which is an associative map, to keep track of (the reference of each) employee object so that you may enumerate (iterate) each object. The map variable keeps track of the pair of Employee: (1) Employee Name and (2) the Reference to the object of the employee. Then output each employee record using the map sorted by Name to a file (emp3.txt). Output each sorted result to a file: emp2txt (format similar-to Task#1). Record #1 ID-2233 Name charlea bais Position-gm Department-sales BithDate-12/12/52 Salary-90000 And so on. Task #3. Open a file (emp3bin) for write, (2) iterate each employee object with the map, (3) to write each object into a binary file (emp3.bin), (4) to close the file after all the records written, (5) to delete all the instances of the employee objects, and then (6) to open the file (emp3.bin) for read, (7) to read each record to create its instance of employee object, (8) output each instance to the console and to a file (emp3.txt), and (9) to close the file, and the program execution is terminated

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago

Question

So what disadvantages have you witnessed? (specific)

Answered: 1 week ago