Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

C++ Modify the merge sort algorithm to sort a vector of employees by salary. (2) Based on Problem P11.4 . Modify the merge sort algorithm

C++ Modify the merge sort algorithm to sort a vector of employees by salary.

image text in transcribed

(2) Based on Problem P11.4 . Modify the merge sort algorithm to sort a vector of Employees by salary. The class Employee in this problem is assumed to be class Employee I public: Employee (string e_name, double e_salary) :name (e_name), salary (e_salary) f string get_name const return name; double get_salary) const return salary; h protected: string name; double salary; . Write a program that reads the list of people's records from a file data2.txt, creates a corresponding vector and displays the name and salary for each employee After that the program should sort vector and display the name and the salary of employees in the sorted vector (for details see IO sample below) . You can assume that data for each employee is stored in data2.txt as name I salary (one data record per line) and that the file has at least one line . Submit the solution as hmw.5.2.cpp . Sample input-output data2.txt _ Not...-- exe File Edit Format View Hel John Doe | 65000 Lisa Smithl75000 Alex Taylor |55000 Enplo yees. before sorting: ohn Doe, $65000 Lisa Smith. $75000 lex Taylor. $55000 Enployees. after sorting: lex Taylor. $55000 ohn Doe, $65000 Lisa Smith. $?5000 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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