Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Final Project Help hyg71886 Programmer named Tim Posts: 11 Threads: 2 Joined: Jan 2019 Reputation: 0 Likes received: 0 #1 Feb-05-2019, 03:06 PM Good morning everyone, I am working on my final project but am hitting a wall. My assignment is as follows The 1040EZ is an IRS form for individuals to complete their income taxes. It is easy to complete, hence the “EZ” in the name. In addition to personal information, there are only 14 lines on the 1040EZ. The lines are shown in the Appendix A. For your final project, you will create a program to allow the user to complete the 1040EZ form. You will notice that some lines on the form require the user to enter information. See lines 1, 2, 3, 7, 8, and 11. Other lines are calculations, which your program needs to perform for the user. See lines 4, 5, 6, 9, 10, 12, 13, and 14. To complete a program for the 1040EZ you would need to know conditions, but we have not covered them in this course. Conditions will be covered in the next course. So, to make this project easier we will make a few changes to the form. Here are the changes. 1. Line 5 will always be \$10,150. 2. On Line 10 it states to look up the amount on a tax table. For this project, Line 10 will be computed as the value of Line 6 multiplied by 0.15. 3. Line 13 is completed if the user gets a refund and Line 14 is completed if the user owes money. Let’s remove Line 14 and say that if the value in Line 13 is negative, the user owes money. In addition to these requirements there is one requirement concerning how you code this project. All of the values (entered by the user and computed) must be stored in an array. Below is some sample output. Review it carefully. When you see a “>>” it means that what is to the right of it was entered by the user. Notice that the user does not enter computed values: The program computes them and displays the results. Sample Output 1 Welcome to the 1040EZ Tax Form Application 1 Wages, salaries, and tips. This should be shown in box 1 of your Form(s) W-2. Attach your Form(s) W-2. >> 100050.00 2 Taxable interest. >> 510.15 3 Unemployment compensation and Alaska Permanent Fund dividends. >> 0.00 4 Add lines 1, 2, and 3. This is your adjusted gross income. \$100,560.15 5 If no one can claim you (or your spouse if a joint return), enter \$10,150 if single; \$20,300 if married filing jointly. See back for explanation. 10,150 6 Subtract line 5 from line 4. If line 5 is larger than line 4, enter -0-. This is your taxable income. \$90,410.15 7 Federal income tax withheld from Form(s) W-2 and 1040. >> 7,876.25 8 Earned income credit (EIC) >> 0.00 9 Add lines 7 and 8. These are your total payments and credits. \$7,876.25 10 Tax. Multiply Line 6 by 0.15. \$13,561.52 11 Health care: individual responsibility >> 0.00 12 Add lines 10 and 11. This is your total tax. \$13,561.52 Everything runs smooth until line 9 computes. Instead of computing and automatically going to the next line, it just prints 7876.25. When I hit enter I get this error Traceback (most recent call last): File "C:\Users\BlackPearl\Desktop\Project one\final.py", line 15, in int(input('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1]))) ValueError: invalid literal for int() with base 10: '0.00' This is the code I ran ```print("Welcome to the 1040EZ Tax Form Application") t = ["","",""] x = [""] t[0] = eval (input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2.")) t[1] = eval (input ("Taxable interest.")) t[2] = eval (input ("Unemployment compensation and Alaska Permanent Fund dividends.")) t4 = print("Add lines 1, 2, and 3. This is your adjusted gross income.", + t[0] + t[1] + t[2]) x = 10150 t = t[0] + t[1] + t[2] - x print("If no one can claim you (or your spouse if a joint return), enter \$10,150 if single; \$20,300 if married filing jointly. See back for explanation.", x) print("Subtract line 5 from line 4.", t) z = ["",""] z[0] = eval (input ("Federal income tax withheld from Form(s) W-2 and 1040.")) z[1] = eval (input ("Earned income credit (EIC)")) int(input('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1]))) b = [""] b[0] = t * 0.02 print("Tax. Multiply Line 6 by 0.15.", b) d = [""] d[0] = eval (input ("Health care: individual responsibility")) c = [""] c[0] = print("Add lines 10 and 11. This is your total tax.", b[0] + d[0]) print("If line 9 is larger than line 12, subtract line 12 from line 9. This is your refund.") ```You guys were a great help on my arrays assignment so I hope you can help me figure this out as well. I need that line to just print and go to the next line ichabod801 Bunny Rabbit Posts: 3,527 Threads: 74 Joined: Sep 2016 Reputation: 197 Likes received: 1072 #2 Feb-05-2019, 04:00 PM If you are expecting the user to press enter at that point, you should not be converting it to int (line 15). You should just do nothing with it. Note that t4 on line 7 is always going to be None, because you are using print instead of input. I would also say that eval is overkill for this situation. I would use int or maybe float. Craig "Ichabod" O'Brien - xenomind.com I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures hyg71886 Programmer named Tim Posts: 11 Threads: 2 Joined: Jan 2019 Reputation: 0 Likes received: 0 #3 Feb-05-2019, 04:04 PM Ok I'll change everything to int. The line in question I don't want the user to do anything for that line I just want it to print and automatically go to the next after it does the calculation. I tried recoding it a few ways but couldn't get it to worm ichabod801 Bunny Rabbit Posts: 3,527 Threads: 74 Joined: Sep 2016 Reputation: 197 Likes received: 1072 #4 Feb-05-2019, 08:57 PM If you want to print and move on, use print (that is, `print(...)` instead of `int(input(...))`). Craig "Ichabod" O'Brien - xenomind.com I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures hyg71886 Programmer named Tim Posts: 11 Threads: 2 Joined: Jan 2019 Reputation: 0 Likes received: 0 #5 Feb-06-2019, 01:36 AM (This post was last modified: Feb-06-2019, 01:36 AM by hyg71886. Edited 2 times in total. Edit Reason: update ) Switched everything out and the code works as long as I don't put in a . if i do i get this error Traceback (most recent call last): File "C:\Users\BlackPearl\Desktop\Project one\final.py", line 4, in t[0] = int(input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2.")) ValueError: invalid literal for int() with base 10: '100050.00' Here is the code ```print("Welcome to the 1040EZ Tax Form Application") t = ["","",""] x = [""] t[0] = int(input ("Wages, salaries, and tips. This should be shown in box 1 of your Forms(s)W-2. Attach your Form(s) W-2.")) t[1] = int(input ("Taxable interest.")) t[2] = int(input ("Unemployment compensation and Alaska Permanent Fund dividends.")) t4 = print("Add lines 1, 2, and 3. This is your adjusted gross income.", + t[0] + t[1] + t[2]) x = 10150 t = t[0] + t[1] + t[2] - x print("If no one can claim you (or your spouse if a joint return), enter \$10,150 if single; \$20,300 if married filing jointly. See back for explanation.", x) print("Subtract line 5 from line 4.", t) z = ["",""] z[0] = int(input ("Federal income tax withheld from Form(s) W-2 and 1040.")) z[1] = int(input ("Earned income credit (EIC)")) print('Add lines 7 and 8. These are your total payments and credits. {}'. format(+ z[0] + z[1])) b = [""] b[0] = t * 0.02 print("Tax. Multiply Line 6 by 0.15.", b) d = [""] d[0] = int(input ("Health care: individual responsibility")) c = [""] c[0] = print("Add lines 10 and 11. This is your total tax.", b[0] + d[0]) print("If line 9 is larger than line 12, subtract line 12 from line 9. This is your refund.")```update: I changed it to float instead of int and that seems to have fixed the . issue. Thanks so much for the help ichabod801 Bunny Rabbit Posts: 3,527 Threads: 74 Joined: Sep 2016 Reputation: 197 Likes received: 1072 #6 Feb-06-2019, 03:12 AM I only suggested int because tax calculations are usually done on whole dollars. But if your are entering the cents, you would want to use float. Craig "Ichabod" O'Brien - xenomind.com I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures micseydel Involuntary Spiderweb Collector Posts: 1,972 Threads: 49 Joined: Sep 2016 Reputation: 45 Likes received: 586 #7 Feb-07-2019, 01:30 AM (Feb-06-2019, 03:12 AM)ichabod801 Wrote: I only suggested int because tax calculations are usually done on whole dollars. But if your are entering the cents, you would want to use float. I strongly recommend not using floats for serious dealing with money, my understanding is that such calculations are typically done with ints in cents, unless you need more precision than that. « Next Oldest | Next Newest »

Top Page

 Possibly Related Threads... Thread Author Replies Views Last Post How to update set of hash values until final hash value is found using the 5 hashes shakespeareeee 1 89 Jul-25-2019, 12:34 AM Last Post: Larz60+ Trouble with edX Python Final sarah_mb_sues 11 3,576 Jun-19-2018, 10:36 AM Last Post: cryomick Final problem Truman 4 951 Jan-22-2018, 11:42 PM Last Post: Truman

Forum Jump:

Users browsing this thread: 1 Guest(s)