For this assignment, each student will write a program to estimate federal tax obligations and effective tax rate.


The United States Internal Revenue Service collects taxes from those who earn income in the United States. Ignoring all tax deductions and loopholes, those who earn more are require to contribute a higher percentage of their income. The following table shows the tax brackets for 2021.

Rate Single Filers Married Joint Filers
10% $0 to $9,950 $0 to $19,900
12% $9,951 to $40,525 $19,901 to $81,050
22% $40,526 to $86,375 $81,051 to $172,750
24% $86,376 to $164,925 $172,751 to $329,850
32% $164,926 to $209,425 $329,851 to $418,850
35% $209,426 to $523,600 $418,851 to $628,300
37% $523,601+ $628,301+

Note that the first $9,950 of all single filers income is taxed at the 10% rate, the next $30,575 (= 40,525 - 9,950) is taxed at 12%, etc... For example, taxes due for a single filer with $66,480 in income would be $10,374, which is calculated as follows: 0.10 x 9950 + 0.12 x 30575 + 0.22 x 25955. Note: tax obligations are rounded to the nearest whole dollar.

The effective tax rate is calculated as the amount of taxes due divided by the total income. In our specific example this would be 15.6% = 100% x ($10374/$66480).

Write a program that asks the user if they are a single filer or married joint filer. It should then ask for their expected earned income for 2021 and display the estimated taxes they will be required to pay by April 15, 2022 as well as their effective tax rate.

You may develop your own technique for determining if the user is a single or married joint filer, but it must be obvious to the user when the program is run (provide clear instructions).

Your program must be in a class called CalculateTaxes in a package that matches your MSOE username (email address without the @msoe.edu).

A sample program interaction for the program is shown below:

Are you a single filer or a married joint filer (enter 's' or 'j'): s
Enter an estimate of your earned income for 2021: 66480.00

Your estimated taxes for 2021 are: $10374
This results in an 15.6% effective tax rate.

Note: You do not need to have the correct number of digits after the decimal place for the effective tax rate.


This laboratory assignment was developed by Dr. Chris Taylor.

See your professor's instructions for details on submission guidelines and due dates.