CSC111 Homework 1 Solution 2
Revision as of 17:28, 11 February 2010 by Thiebaut (talk | contribs) (moved CSC111 Homwork 1 Solution 2 to CSC111 Homework 1 Solution 2)
Contents
Source Code
# File: hw1.py
# Andrea Spain 111c-aw
# A program indicating an individual's taxes for the year.
# The user inputs his or her name, salary, and deductions and is presented
# with his or her federal, state, and total taxes.
def main():
#--- The user is asked to input their information. ---#
print "This program will compute your taxes for 2009"
first = raw_input ( "Please enter your first name: " )
last = raw_input ( "Please enter your last name: " )
salary = input ( "Enter your salary for 2009: ")
deductions = input ( "Enter your deductions: " )
#--- The inputed information is put into the formulas. ---#
FedTaxes = ( salary - deductions ) * .28
StateTaxes = ( salary - deductions - 1000 ) * .05
total = FedTaxes + StateTaxes
#--- The output is printed. ---#
print ""
print "Dear", first, last, ":"
print "Your federal taxes for 2009 are $ ", FedTaxes
print "Your state taxes for 2009 are $ ", StateTaxes
print ""
print "You will have to pay a total of $ ", total, "in taxes."
main()
Output
This program will compute your taxes for 2009
Please enter your first name: Sophia
Please enter your last name: Smith
Enter your salary for 2009: 100000
Enter your deductions: 1000
Dear Sophia Smith :
Your federal taxes for 2009 are $ 27720.0
Your state taxes for 2009 are $ 4900.0
You will have to pay a total of $ 32620.0 in taxes.