From the course: Learning Java 11

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Salary calculator

Challenge: Salary calculator - Java Tutorial

From the course: Learning Java 11

Start my 1-month free trial

Challenge: Salary calculator

(upbeat music) - [Narrator] It's time to test your knowledge of functions with this coding challenge. Be sure to use what you've learned so far about defining a function, calling a function, and various built-in functions that exist. For this challenge, you will create a function that calculates an employee's salary, given how many hours that are worked per week and how much the person makes per hour. Your inputs should be how many hours the employee works per week and how much the person makes per hour. Your output will be the employee's yearly salary. For this example, we'll be looking at the employee's gross income for the particular job. So there's no need to worry about taxes or 401k or any of that. This is just the total amount made by the employee. For a bonus, add an input that accounts for the vacation days an employee might take. Let's say the employee is a contractor and does not get paid for vacation days. We can assume that a vacation day maps to eight hours of work. For…

Contents