BlueBook
You are to calculate weekly pay of employees based on four factors: rate of pay in dollars, hours worked, tax category, and donations.
Any hours worked over 40 is considered "overtime" and is paid double.
The five tax categories are,
Tax Category | Tax Deduction |
---|---|
A | 0% Tax |
B | 10% tax |
C | 20% tax |
D | 29% tax |
E | 35% tax |
Input Specification
Input starts with , followed by the information for employees on four separate lines. Each employee's information will be separated with one newline.
Line 1: a real number denoting rate of hourly pay in dollars .
Line 2: an integer denoting hours worked. .
Line 3: a character denoting the tax category of how much tax the
government collects.
Line 4: a y
or n
denoting whether they want to donate 10 dollars.
Donations are calculated last.
Output Specification
Output each employee's pay in dollars, rounded to two decimal places.
Sample Input
2
1.0
4
A
n
1.0
41
B
y
Sample Output
4.00
27.80
Comments
I can't believe that it took me so long to work out what I was doing wrong! Doh!!
The overtime is not paid double. If you try to calculate it as such, you'll get incorrect results.
To any future user attempting this question in C or C++, remember to use double instead of float when dealing with a decimal, as it is more accurate. Just a friendly reminder that will prevent any of you guys, especially new people, from getting a WA when your code is correct and your algorithm is accurate. :)