The Hay System is a job performance evaluation method that is widely used by organizations around the world. Corporations use the system to map out their job roles in the context of the organizational structure. One of the key benefits of the method is that it allows for setting competitive, value-based pay policies. The main idea is that for each job evaluation, a number of factors (such as Skill, Effort, Responsibility and Working Conditions) are evaluated and scored by using a point system. Then, the cumulative total of points obtained will be correlated with the salary associated with the job position. As an engineer , you have been commissioned to implement a simplified version of the Hay method using PYTHON. Particularly, the hiring company is interested in getting the salary (or hay system score) for several job descriptions currently performed in the company. Data Representation Unfortunately, the company David and Joseph Ltd. has very strict security policies. Then, you will not be granted access to the main data base. Instead, all the information needed has been compiled in files with the following characteristics.
File 1 1. The first line of the file contains 1 positive integer: num words ≤ 10000, the number of words in the Hay Point dictionary. 2. num words lines follow; each contains a word (a string of up to 16 lower-case letters) and a dollar value (an integer between 0 and 1000000). You can safely assume that the num words words in the dictionary are distinct. Each description word-value is terminated by a line containing a period.
You can take a look about how File 1 looks below.
7 administer 100000 .
spending 200000 .
manage 50000 .
responsibility 25000 .
expertise 100 .
skill 50 .
money 75000
Program Code Screenshot
file1.txt
Program Sample Console Input/Output Screenshot
Program Code to Copy
from typing import Dict, List, TextIO
def create_dictionary(file1: TextIO) -> Dict[str, int]:
# declare a map to store hay scores
haySystemScoreMap = {}
length = -1
# read from file line by line
for line in file1:
words = line.split(' ')
# set length if it is not set
if(length == -1):
length = int(words[0])
words = words[1:]
# add item in hay score map
haySystemScoreMap[words[0]] = int(words[1])
return haySystemScoreMap
# open file
file1 = open('file1.txt', 'r')
# print the hayscore map
print(create_dictionary(file1))
Get Answers For Free
Most questions answered within 1 hours.