#K59092. Calculate Total Monthly Salary Expenditure
Calculate Total Monthly Salary Expenditure
Calculate Total Monthly Salary Expenditure
You are given a JSON string representing employee records. Each record is a key-value pair where the key is the employee's name and the value is an object that contains the employee's designation
and monthly_salary
. Your task is to compute the total monthly salary expenditure and count the total number of employees.
The total monthly salary expenditure is given by $$\text{Total Expenditure} = \sum_{i=1}^{n} \text{monthly_salary}_i,$$ where \(n\) is the number of employees. If the JSON is empty, both values should be 0.
inputFormat
The input is provided via stdin as a single JSON string that may span multiple lines. The JSON represents an object whose keys are employee names and whose values are objects with the keys designation
and monthly_salary
.
outputFormat
Print to stdout two integers separated by a space. The first integer is the total monthly salary expenditure, and the second is the number of employees.
## sample{
"John Doe": {"designation": "Software Engineer", "monthly_salary": 5000},
"Jane Smith": {"designation": "Project Manager", "monthly_salary": 7000},
"Emily Johnson": {"designation": "Data Scientist", "monthly_salary": 6000}
}
18000 3