BlueBook - Pay

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Problem type
BlueBook

You are to calculate weekly pay of T employees (1 \le T \le 1\,000) 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 T, followed by the information for T 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 (\le 1\,000).
Line 2: an integer denoting hours worked. (< 30\,000).
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


  • 0
    Fares_X  commented on Jan. 3, 2023, 9:06 p.m.

    The overtime is not paid double. If you try to calculate it as such, you'll get incorrect results.


  • 8
    jman579  commented on Nov. 21, 2020, 2:59 a.m. edited

    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. :)