Question
1. [Marks: 50%] Write a program that puts the contents of a text file called employees.txt, containing space?separated employees id, salary, and increase percentage, into
1. [Marks: 50%] Write a program that puts the contents of a text file called employees.txt, containing space?separated employees id, salary, and increase percentage, into a dictionary. The program then displays the items of the dictionary in order of increases, from the employee that will receive the smallest increase to the one that will receive the highest increase. For example, consider the following contents of file employes.txt:
100123456 42659.03 3.7
100246800 25498.29 4.5
100654321 46321.11 2.4
The increase is computed by multiplying the salary by the increase percentage. For example, the increases for the example above would be:
100123456 42659.03 3.7 1578.38
100246800 25498.29 4.5 1147.42
100654321 46321.11 2.4 1111.71
And therefore, your program should display the following list of employees sorted by salary increase:
100654321 46321.11 2.4 1111.71
100246800 25498.29 4.5 1147.42
100123456 42659.03 3.7 1578.38
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