#C14300. Employee CSV Data Analysis

    ID: 43935 Type: Default 1000ms 256MiB

Employee CSV Data Analysis

Employee CSV Data Analysis

You are given a CSV formatted input representing employee records. The CSV has a header with three columns: name, department, and salary. Each subsequent line provides the details of one employee. Your task is to calculate the average salary for each department and determine the name of the highest paid employee.

Specifically, you must:
1. Parse the CSV input from standard input.
2. Compute the average salary for each department. Use the formula $\text{Average} = \frac{\text{sum of salaries}}{\text{number of salaries}}$.
3. Identify the employee with the maximum salary.

Finally, print the average salaries for each department in alphabetical order of department names (one per line in the format: Department AverageSalary, where AverageSalary is a floating-point number with one decimal place), followed by a line containing the name of the highest paid employee.

inputFormat

The input comes from standard input and is structured in CSV format. The first line is the header: name,department,salary. Each subsequent line contains the details of one employee with fields separated by commas. It is guaranteed that all fields are non-empty and salary is a valid number.

outputFormat

The output should be printed to standard output. First, print the average salary for each department on separate lines in the format: Department AverageSalary (with the department names in alphabetical order and the average displayed as a floating-point number with one decimal place). Then, on the last line, print the name of the employee with the highest salary.## sample

name,department,salary
John Doe,Engineering,75000
Jane Smith,Marketing,68000
Bob Johnson,Engineering,82000
Alice Davis,HR,60000
Engineering 78500.0

HR 60000.0 Marketing 68000.0 Bob Johnson

</p>