CIT129 - Introduction to Programming
Spring 2024
DO NOT post the text of this assignment on any web sites.
DO NOT share your answers with anyone.
●
•
DO NOT collaborate on completing work with anyone.
•
DO NOT use the Internet to search for solution to assignments.
•
DO NOT pay anyone to write your code.
•
Avoid web sites that offer solutions to assignments. These include AI tools such as
ChatGPT, chegg.com, CourseHero, etc. If you copy work from such web sites, keep
in mind that other students are also looking at the same information and will
therefore submit duplicated work. Failure to meet these requirements leads to the
violation of the academic integrity principles as stated in your syllabus.
Objective: Demonstrate your understanding of solving problems that involve using loops and
decisions in programs. This assignment is based on the material covered in Module 3 (loops) of
your Net Academy and the material offered in Canvas.
Assignment: Write a Python program to process income tax.
Documentation - I am also asking for code documentation. Your program must contain a
standard heading once at the top of your program as follows:
Your full name:
Course number and course section number:
Date of completion:
The time it took you to complete this exercise: Log your time from the time you start this
exercise until completion. For example, you could write 1 hour and 30 minutes, 90 minutes, etc.
Brief explanation of the program: Include a brief explanation of your program here.
You must also document key steps of the program such as major input, processing, and
output sections throughout your code.
In Python, comment lines start with the # symbol. You may also highlight the text you want to
be commented, click Format/Comment Out Region. Make sure to include comments
throughout your code explaining the key steps of the program.
Deliverable: Submit your Python source file. Use the file format:
FirstNameLastNameCIT129_hw9.py for your file name. Submit your file to the assignment
dropbox in Canvas.
Special notes:
•
Format output of any decimal numbers to 2 digits after the decimal point, unless
otherwise noted.
Do not use any exit() functions to exit out of a decision or a loop or in any other
places in your code.
CIT129-Assignment 9 – Module 3 - Loops •
Do not use break or continue in your loops.
•
DO NOT use lists or arrays even if you know how to use them. Code that uses
lists or arrays will not get any credit.
Process:
Write the Python code for the following problem helping an IRS agent calculate income tax
based on user income and filing status. We will use loops to process more than one set of input
values.
•
•
Protect the program with a password so that anyone with the correct password of
"python" can use this program. Allow the user to try as many times as they would like.
Ask for the number of people that we would like to process. Make sure the user inputs a
number between 1 and 20 for the number of people. You need to continue asking for a
valid number of people until valid data is entered.
For each person, in the following order, ask for the filing status (single or married) and
income for the person. Assume the user will only enter data in lower case for filing
status.
If the filing status is entered as anything but single or married, continue asking until a
valid filing status is entered.
• Use the following table to calculate tax:
Income
From
Filing as single
To
Tax Due
$0
More than $50,000
$50,000
$100,000
More than $100,000
10% of income
$2500+12% of amount
over $50,000
$6000+15% of amount
over $100,000
Income
Filing as married
Tax Due
From
$0
More than $50,000
To
$50,000
$100,000
5% of income
$2500+8% of amount over
$50,000
More than $100,000
$6000+10% of amount
over $100,000
• Calculate tax due.
•
Display filing status, income, and the amount of tax due.
• Display the total number of people.
•
Calculate and display the grand total of all income values entered by the user.
●
Calculate and display the grand total of all tax values entered by the user.
CIT129-Assignment 9 – Module 3 - Loops Display the following information in a format very close to the following sample run. For
example, you need to display the labels as stated, below. Make sure to test for all possible cases
to assure your program is functioning properly.
Sample run:
Enter your password: me
Incorrect password - Try again: hello
Incorrect password - Try again: python
How many people would you like to process today? -5
Invalid input- try again 30
Invalid input - try again 4
Are you married or single? single
What is your income: 60000
Filing Status: single
Income: $60000.00
Tax: $3700.00
2500+0.12*(60000 - 50000)
Are you married or single? joint
<