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 - Java Tutorial
From the course: Learning Java 11
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
What are functions? (conceptually)4m 25s
-
(Locked)
Defining functions in Java3m 28s
-
(Locked)
Calling functions in Java5m 9s
-
(Locked)
Parameters in Java5m 30s
-
(Locked)
Return types in Java5m 34s
-
(Locked)
Using built-in functions in Java4m 43s
-
(Locked)
Challenge: Salary calculator1m 21s
-
(Locked)
Sample solution: Salary calculator3m 46s
-
(Locked)
-
-