#K94762. Employee Salary Analysis
Employee Salary Analysis
Employee Salary Analysis
You are given a string containing data of several employees. Each employee record is formatted as id|name|salary
and multiple records are separated by a comma and a space.
Your task is to calculate the total salary, identify the employee with the highest salary, and determine the median salary (using integer division for even number of employees) from the given data string.
If the input string is empty or contains no employee data, output should be: Total: 0 Highest: None Median: 0
.
For example:
- Input:
101|Alice|5000, 102|Bob|7000, 103|Charlie|6000, 104|David|8000, 105|Eve|5500
- Output:
Total: 31500 Highest: David Median: 6000
Note: If the number of employees is even, the median is computed as the average of the two middle salaries, and then converted to an integer.
inputFormat
The input is provided via standard input (stdin) as a single line string. This string contains employee records in the format id|name|salary
separated by ,
(a comma followed by a space). The input may be empty.
outputFormat
Output the result to standard output (stdout) as a single line string in the following format:
Total: T Highest: NAME Median: M
Where T
is the sum of all salaries, NAME
is the name of the employee with the highest salary, and M
is the median salary computed over all employees. If the list is empty, print Total: 0 Highest: None Median: 0
.
101|Alice|5000, 102|Bob|7000, 103|Charlie|6000, 104|David|8000, 105|Eve|5500
Total: 31500 Highest: David Median: 6000