Difference between revisions of "CSC111 Homework 1 Solution"
(Created page with '==Source Code== <source lang="python"> # hw1.py # Kristina Fedorenko # 111c-aq # # This program computes taxes for 2009 # based on user's salary and deductions. This information …') |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | __TOC__ | ||
+ | <onlydft> | ||
==Source Code== | ==Source Code== | ||
<source lang="python"> | <source lang="python"> | ||
# hw1.py | # hw1.py | ||
− | # Kristina Fedorenko | + | # Kristina Fedorenko |
# 111c-aq | # 111c-aq | ||
# | # | ||
Line 19: | Line 21: | ||
def main (): | def main (): | ||
# *^*^*^*^*^ask user to provide all the information needed*^*^*^*^*^ | # *^*^*^*^*^ask user to provide all the information needed*^*^*^*^*^ | ||
− | print | + | print |
print 'Welcome!' | print 'Welcome!' | ||
− | print | + | print |
print 'This program will compute your taxes for 2009.' | print 'This program will compute your taxes for 2009.' | ||
− | print | + | print |
print 'You will be asked to enter some information. Please do NOT include' | print 'You will be asked to enter some information. Please do NOT include' | ||
print '$ symbols or commas in your answers.' | print '$ symbols or commas in your answers.' | ||
− | print | + | print |
first = raw_input('Please enter your first name: ') | first = raw_input('Please enter your first name: ') | ||
last = raw_input('Please enter your last name: ') | last = raw_input('Please enter your last name: ') | ||
Line 38: | Line 40: | ||
# *^*^*^*^*^show results to user*^*^*^*^*^ | # *^*^*^*^*^show results to user*^*^*^*^*^ | ||
− | print | + | print |
print 'Dear', first, last+':' | print 'Dear', first, last+':' | ||
− | print | + | print |
print 'Your federal taxes for 2009 are:','$', federal | print 'Your federal taxes for 2009 are:','$', federal | ||
− | print | + | print |
print 'Your state taxes for 2009 are: ','$', state | print 'Your state taxes for 2009 are: ','$', state | ||
− | print | + | print |
print 'You will have to pay a total of', '$', total, 'in taxes.' | print 'You will have to pay a total of', '$', total, 'in taxes.' | ||
− | print | + | print |
print 'Thanks for using this program!' | print 'Thanks for using this program!' | ||
− | print | + | print |
main () | main () | ||
</source> | </source> | ||
+ | |||
==Output== | ==Output== | ||
Line 80: | Line 83: | ||
</pre></code> | </pre></code> | ||
+ | </onlydft> | ||
+ | <br /> | ||
+ | <br /><br /><br /><br /><br /><br /> | ||
+ | [[Category:CSC111]][[Category:Python]][[Category:Homework]] |
Latest revision as of 09:38, 7 September 2011