BlueBook
p108ex9: Pay
You are to calculate weekly pay of T employees (1 ≤ T ≤ 1000) 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
Input starts with T, followed by the information for T employees on four separate lines. Each employee's information will be seperated with one newline.
Line 1 : a real number denoting rate of hourly pay in dollars (≤ 1000).
Line 2 : an integer denoting hours worked. (< 30000).
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
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
All Submissions
Best Solutions
Point Value: 4
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 26, 2008
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
18467
A
y
Is this the correct input values for the 1st guy's pay?
If so, I was wondering what should be the correct output, my program prints 15116.54
I was just wondering about this, because the second line (indicating hours) is 18467, but the question states that it hours must be less than 216. This is the source of my confusion.
15116.54 is indeed the correct output for that input.
I was just wondering if you could take a look at my submission and see why I get 0/10. I would figure I would at least get 1/10 for getting the first output right then.
Base pay is $1/hr * 41 hours = $41. Right?
Adding double pay is + $1/hr * (41 - 41 = 1) hours = +$1 = $42.
Subtracting tax is -10% = 42 - 4.2 = 37.8...?
Then the donation of $10 makes it $27.80.
So what's wrong?
Thanks in advance for the help.
--Brian