Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose A review of pointers, dynamic memory allocation/deallocation, struct data type, array, sorting, memory leak, dangling pointers in C++ The expected output results are shown

image text in transcribedimage text in transcribedimage text in transcribedPurpose A review of pointers, dynamic memory allocation/deallocation, struct data type, array, sorting, memory leak, dangling pointers in C++

The expected output results are shown on the images above. Project description:This project utilizes PA1, handling employee information from the given file. The requirements are as follows. 1. Define a struct data type named Employee that has employee code, social security number, first name, last name, department name, role, and salary. The employee code, S, indicates a salaried employee.

2. As your program reads the information of an employee from the file, it must dynamically allocate a memory (Employee type) to store the employee

3. Add sorting functionality to your program that sorts employees based on last name, SSN, Salary. To sort employee by last name, SSN, and salary, use the bubble sort(to sort last name), selection sort(to sort SSN), and insertion sort(for Salary), respectively.

4. Deallocate all dynamically allocated memory in your program Documentation 1. Attach a file written in MS Word that captures the results of ls al command, compilation process and results, and program execution on the CS server

The employee text file information is pasted below(employee.txt)

S 135-25-1234 Sophia Smith DevOps Developer 70000 S 135-67-5462 Jacob Johnaon SecOps Pentester 130000 S 252-34-6728 Emma William DevOps DBExpert 100000 S 237-12-1289 Mason Miller DevOps CloudArchitect 80000 S 581-23-4536 Jayden Jones SecOps Pentester 250000 S 501-56-9724 Mia Rogers DevOps Auditor 90000 S 408-67-8234 Choloe Cook DevOps QAEngineer 100000 S 516-34-6524 Daniel Morris DevOps ProductOwner 300000 S 526-47-2435 Natalie Smit DevOps Developer 130000 S 530-46-8245 Grace Johnson SecOps SecurityEngineer 300000 S 035-35-6472 Avery Allen DevOps TechnicalLead 250000 S 222-35-9324 Joshua Youn DevOps ScrumMaster 150000 S 407-36-1285 Elijah Hall DevOps QAEngineer 100000 S 251-98-2836 Davia Wright Devops CloudArchitect 200000 S 627-67-9879 Andrew Rogers Devops SystemAdmin 100000 S 509-45-0909 Joshua Park SecOps SecurityArchitect 250000 S 408-12-8976 Stewart Thomson DevOps DeploymentEngineer 250000 S 425-90-2010 Sanjeev Sharma DevOps WorldwideLead 350000 S 433-44-2324 Sandra Sellters AccountFinance AccountingManager 200000 S 486-88-9981 Dennis Arthur AccountFinance Accountant 60000 S 478-77-2763 Daniel Weaver Sales SalesManager 70000 S 505-55-8786 Amanda Byron Sales SalesAssociate 70000 S 429-30-3678 Megan Finley Administration OfficeManager 80000

5 vcpkg: a tatra nati tatra nati B PA2 (1).p. O PA2S X + V - 0 X 6 | 4 Cay S. Hc o n of 5 lo S2020 Lit Input Ou article1.p D PA1 Sam . Start file:///C:/Users/ateya/Downloads/PA2%20Sample%20Output.pdf - + Fit to page ID Page view AV Read aloud Add notes F Enter a number to select what you want : 3 Type SSN Lastname Firstname Department Role Salary 486-88-9981 135-25-1234 478-77-2763 505-55-8786 237-12-1289 429-30-3678 501-56-9724 252-34-6728 407-36-1285 408-67-8234 627-67-9879 135-67-5462 526-47-2435 222-35-9324 251-98-2836 433-44-2324 035-35-6472 408-12-8976 509-45-0909 581-23-4536 516-34-6524 530-46-8245 425-90-2010 Arthur Dennis Smith Sophia Weaver Daniel Byron Amanda Miller Mason Finley Megan Mia William Emma Hall Elijah Cook Choloe Rogers Andrew Johnaon Jacob Smith Natalie Youn Joshua Wright Davia Sellters Sandra Allen Avery Thomson Stewart Park Joshua Jones Jayden Morris Daniel Johnson Grace Sharma Sanjeev Account Finance DevOps Sales Sales DevOps Administration DevOps DevOps DevOps DevOps Devops SecOps DevOps DevOps Devops AccountFinance DevOps DevOps SecOps Secops DevOps SecOps DevOps Accountant Developer SalesManager SalesAssociate CloudArchitect OrficeManager Auditor DBExpert QAEngineer QAEngineer SystemAdmin Pentester Developer ScrumMaster CloudArchitect AccountingManager Technical lead DeploymentEngineer SecurityArchitect Pentester ProductOwner Security Engineer Worldwide Lead 60000.00 70000.00 70000.00 70000.00 80000.00 80000.00 90000.00 100000.00 100000.00 100000.00 100000.00 130000.00 130000.00 150000.00 200000.00 200000.00 250000.00 250000.00 250000.00 250000.00 300000.00 300000.00 350000.00 -------- Sort Menu ---- 1. Sort by last name 2. Sort by SSN 3. Sort by salary 4. Exit Enter a number to select what you want : x Enter a number to select what you want : Y Enter a number to select what you want : 4 6 vcpkg: a b tatra nati tatra nati PA2 (1).p. PA2S X + V - 0 X 5 Cay S. Hc o n 2 of 5 10 S2020 Lit Input Ou article1.p D PA1 Sam . Start file:///C:/Users/ateya/Downloads/PA2%20Sample%20Output.pdf - + O Fit to page ID Page view A Read aloud Add notes 6 E 3 Enter a number to select what you want : 1 Type SSN Lastname Firstname Department Role Salary 8 035-35-6472 486-88-9981 505-55-8786 408-67-8234 429-30-3678 407-36-1285 135-67-5462 530-46-8245 581-23-4536 237-12-1289 516-34-6524 509-45-0909 501-56-9724 627-67-9879 433-44-2324 425-90-2010 135-25-1234 526-47-2435 408-12-8976 478-77-2763 252-34-6728 251-98-2836 222-35-9324 Allen Avery Arthur Dennis Byron Amanda Cook Choloe Finley Megan Hall Elijah Johnaon Jacob Johnson Grace Jones Jayden Miller Mason Morris Daniel Park Joshua Rogers Mia Rogers Andrew Sellters Sandra Sharma Sanjeev Smith Sophia Smith Natalie Thomson Stewart Weaver Daniel William Emma Wright Davia Youn Joshua DevOps AccountFinance Sales DevOps Administration DevOps Secops SecOps Secops DevOps DevOps SecOps DevOps Devops AccountFinance DevOps DevOps DevOps DevOps Sales DevOps Devops DevOps Technicallead Accountant SalesAssociate DAEngineer OrficeManager QAEngineer Pentester SecurityEngineer Pentester CloudArchitect ProductOwner SecurityArchitect Auditor SystemAdmin AccountingManager Worldwide lead Developer Developer DeploymentEngineer Sales Manager DBExpert CloudArchitect ScrumMaster 250000.00 60000.00 70000.00 100000.00 80000.00 100000.00 130000.00 300000.00 250000.00 80000.00 300000.00 250000.00 90000.00 100000.00 200000.00 350000.00 70000.00 130000.00 250000.00 70000.00 100000.00 200000.00 150000.00 S 5 vcpkg: a b tatra nati tatra nati PA2 (1).p. PA2S X + V - 0 X 6 | 3 Cay S. Hc o n of 5 lo S2020 Lit Input Ou article1.p D PA1 Sam . Start file:///C:/Users/ateya/Downloads/PA2%20Sample%20Output.pdf - + O Fit to page OD Page view AV Read aloud Add notes 6 E B & -------- Sort Menu ---- 1. Sort by last name 2. Sort by SSN 3. Sort by salary 4. Exit Enter a number to select what you want : 2 Type SSN Lastname Pirstname Department Role Salary s 035-35-6472 135-25-1234 135-67-5462 222-35-9324 237-12-1289 251-98-2836 252-34-6728 407-36-1285 408-12-8976 408-67-8234 425-90-2010 429-30-3678 433-44-2324 478-77-2763 486-88-9981 501-56-9724 505-55-8786 509-45-0909 516-34-6524 526-47-2435 530-46-8245 581-23-4536 627-67-9879 Allen Smith Johnaon Youn Miller Wright William Hall Thomson Cook Sharma Finley Sellters Weaver Arthur Rogers Byron Park Morris Smith Johnson Jones Rogers Avery Sophia Jacob Joshua Mason Davia Emma Elijah Stewart Choloe Sanjeev Megan Sandra Daniel Dennis Mia Amanda Joshua Daniel Natalie Grace Jayden Andrew DevOps DevOps SecOps DevOps DevOps Devops DevOps DevOps DevOps DevOps DevOps Administration AccountFinance Sales AccountFinance DevOps Sales SecOps DevOps DevOps Secops SecOps Devops TechnicalLead Developer Pentester ScrumMaster CloudArchitect CloudArchitect DBExpert QAEngineer Deployment Engineer QAEngineer Worldwide Lead OrriceManager AccountingManager SalesManager Accountant Auditor SalesAssociate SecurityArchitect Product Owner Developer SecurityEngineer Pentester SystemAdmin 250000.00 70000.00 130000.00 150000.00 80000.00 200000.00 100000.00 100000.00 250000.00 100000.00 350000.00 80000.00 200000.00 70000.00 60000.00 90000.00 70000.00 250000.00 300000.00 130000.00 300000.00 250000.00 100000.00

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions