Question: Javascript You are working in the payroll department at a post-secondary institution and you are responsible for calculating the monthly salary for each employee. An

Javascript
You are working in the payroll department at a post-secondary institution and you are responsible for calculating the monthly salary for each employee. An employee works 7.5 hours a day but only during weekdays. You need to write a function that calculates the exact payout for an employee at the end of the month based on the number of working days in that month. You need to input the month and year to calculate the number of working days. You will also need to accept the hourly wage (as input from the user) to find out how much an employee will make for the month.
function daysInMonth (month, year) { // Use 1 for Jan, 2 for Feb, etc.
return new Date(year, month, 0).getDate();
}
For the above function, you can accept input from the user for month in the range of 1-12. JavaScript uses the numerical value in the range of 0-11. The reason why this function works is because with JavaScript, day 0 is the last day of the previous month. In this way we can get a numerical value for the total number of days in the month. You can test this function by displaying the result to the console. For example:
console.log(daysInMonth(1, 2019)); //returns 31
Once you have the number of days in the month, you will need to add up the weekdays in the month.
Part 1 Question 2 Month: December Year: 2017 Weekdays: 21 Salary: $50.00 Pay: $7875.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
