Overview

In this project you will compute a bi-weekly paycheck for an employee, given their salary, and marital status.

Objectives

Using what you have learned so far in this class, you will demonstrate understanding of

  • input/output
  • variables
  • arithmetic expressions
  • branching statements (if-else)
  • equality and comparison operators
  • code blocks and indentation

Description

You will compute a user's bi-weekly paycheck (every two weeks). Gross pay is the employee's stated salary; however, we know that there are many deductions from gross pay to get net pay - the actual amount paid in the paycheck. For purposes of this project, we will only be concerned with two deductions, one for health insurance and the other for federal taxes.

The health insurance deduction is a flat rate of $800 per year if the employee is single and $1000 if the employee is married.

The federal tax deduction is based on the employee's marital status and their annual salary according to the following table. Note that this table is expressed in annual (yearly) terms and any calculation resulting from this table must be prorated to the bi-weekly pay frequency we are asking you to calculate.

The tax for an employee whose marital status is single will be based on the following table:

Annual Income Tax Due (Single)
0.00 to 10000.00 5% of annual income
10000.01 to 50000.00 $500 plus 10.5% of income over 10000
Over 50000.00 $4700 plus 20.25% of income over 50000

Tax for an employee whose marital status is married will be based on the following table:

Annual Income Tax Due (Married)
0.00 to 25000.00 6.25% of annual income
25000.01 to 90000.00 $1562.50 plus 10.75% of income over 25000
Over 90000.00 $8550.00 plus 22.5% of income over 90000

Remember that your calculation from these tables will give you an annual tax amount and you need to adjust it to represent the bi-weekly tax deduction.

You will ask the user for their salary, and whether they are married or single.

You should use input prompts to tell the user what they should enter.

The salary should be input as gross yearly salary, with no dollar signs or commas. When you read in the salary, you should account for the fact that the salary may be input as dollars and cents, eg, 42000.50.

The marital status will be entered as a single letter, 'M' or 'S' which represents married vs. single status.

You will compute the gross pay for a single paycheck, which covers two weeks. You will also need to compute the deductions (health insurance and taxes) for the paycheck, and the net pay. You will then print these amounts as shown in the following example. Note: You should compute everything with as much precision as possible to save the amounts of fractional cents, but in order to print in just dollars and cents, you will need to round to the nearest penny (2 decimal places). An example of using the round function to 2 decimal places is as follows (assuming the computed net pay is in the variable net_pay):

rounded_net_pay = round(net_pay,2)

Once again, do your computations without rounding, but round only when it is time to print out the amounts. You should print a message indicating the gross pay, the deductions, and the paycheck amount, as in the following example:

For inputs of 42000.55 and M, you would print out

For this pay period:
The gross pay is $1615.41
Total deductions are $168.85
The paycheck is $1446.56

Remember that white space is important!

IMPORTANT NOTE: You should start this project right away, even though we have not covered conditionals in chapter 4 yet. You should write the program assuming that everyone has a salary over $25,000 but less than $90,000, and is married. Get that working completely. If you do, you will pass test cases 1 and 3, and you can be confident that your expressions and logic is correct for a single case in the table.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.