subject

In this question, you will use loops and methods to generalize the work you did in Assignment 1. Basically, you will make your Assignment 1's program process an arbitrary number of employee. Moreover, you will use methods modularize your code. Your need to implement the following two methods that will be used in your program: 1. calculatePay: this method takes two numeric input parameters that represent hourlyPay (of type double) and numberOfHours (of type int). The method then calculates and return the employee's pay. Note that the company pays 1.5 for hours above 10 hours. For example, if an employee's hourly pay is 20 and the employee worked 10 hours, then the net pay for that employee is 200 (20*10). On the other hand, if the employee worked 15 hours for the same hourly pay, then the employee's net pay will be 350 (10*20 5*20*1.5).
2. calculateTax: this method takes one double input parameter that represents the employee's pay. The method then calculates and returns the tax to be deducted from that employee using the following rules:
a. no tax will be deducted for pay <= 500.
b. 5% tax will be deducted for pay > 500 and <= 1500
c. 7% tax will be deducted for pay > 1500.
Follow the following steps in implement your main method:
1. Ask the use to enter the number of employees to be processed and read this number.
2. Make a loop where the number of iterations is equal to the number of employees and each iteration in the loop does the following:
a. Ask the user to enter the employee's hourly rate and read the number
b. Ask the user to enter the employee's hours worked and read the number
c. Call the calculatePay method that returns the employee's pay before tax
d. Use the output that is returned by the calculatePay method as input to calculateTax method to find the tax to be deducted from that employee.
e. Print the employee's pay check details
Enter number of employees: 3
Employee #1
Hourly rate:
20
Hours:
20
Pay: 500.0
Tax: 0.00
Net pay: 500.00

Employee #2
Hourly rate:
20
Hours:
40
Pay: 1100.0
Tax: 55.00
Net pay: 1045.00
Employee #3
Hourly rate:
30
Hours:
40
Pay: 1650.0
Tax: 115.50
Net pay: 1534.50

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Hey i just logged on and one of the moderators deleted a bunch of my answers to questions, even though the answers were right and the people it doesn't make sense but if anyone wants to talk about anything just message me lol (this is super random lol)
Answers: 1
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
You know the right answer?
In this question, you will use loops and methods to generalize the work you did in Assignment 1. Bas...
Questions
question
Mathematics, 19.02.2020 05:18
question
Mathematics, 19.02.2020 05:18
question
Mathematics, 19.02.2020 05:19
Questions on the website: 13722360