Question

Add radio button options for filing status to the tax calculator program of Project 1. The...

Add radio button options for filing status to the tax calculator program of Project 1. The user selects one of these options to determine the tax rate. The Single option’s rate is 20%. The Married option is 15%. The Divorced option is 10%. The default option is Single.

For the calculations from Project 1, I was gonna use this.

TAX_RATE = 0.20

STANDARD_DEDUCTION = 10000.0

DEPENDENT_DEDUCTION = 3000.0

# Request the inputs gross

Income = float(input("Enter the gross income: "))

numDepend = int(input("Enter the number of dependents: "))

# sets the value for TAX_RATE

option = int(input("Select 1 of these : 1.Single 2.Married 3.Divorced "))

if option == 2 :

TAX_RATE = 0.15

elif option == 3 :

TAX_RATE = 0.10

# Compute the income tax

taxableIncome = grossIncome - STANDARD_DEDUCTION - \

DEPENDENT_DEDUCTION * numDepend

incomeTax = taxableIncome * TAX_RATE

# Display the income tax

print("The income tax is $" + str(incomeTax))

And what I have for implementing this in a GUI is as follows:

from breezypythongui import EasyFrame

class TaxCalculator(EasyFrame):

    """Application window for the tax calculator."""

    def __init__(self):

        """Sets up the window and the widgets."""

        EasyFrame.__init__(self, title = "Tax Calculator")

        # Label and field for the income

        # (self.incomeField)

        # Label and field for the number of dependents

        # (self.depField)

        # Radio buttons for filing status

        # Button group (self.statusGroup)

        # Option for single (self.single)

        # Option for married (self.married)

        # Option for divorced (self.divorced)

        # The compute button

        # Label and field for the tax

        # (self.taxField)

    # The event handler method for the button

    def computeTax(self):

        """Obtains the data from the input field and uses

        them to compute the tax, which is sent to the

        output field (taxField)."""

        pass

        

        

def main():

    TaxCalculator().mainloop()

if __name__ == "__main__":

    main()


Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

As project 1 is not known ..use the below radio button code in your project of python.

___________________________

# import tkinter for python gui elements

from tkinter import *

# function definition

def tax():

# assuming some amount to find the tax amount

amount = 35000

# if the selected option is 'single' then get 20% of assumed amount

if var.get() == 1:

tax_amt = 0.2 * amount

# if 'married' then 15% of assumed amount

elif var.get() == 2:

tax_amt = 0.15 * amount

# if divorced then 10% of assumed amount

elif var.get() == 3:

tax_amt = 0.1 * amount

# some display text

disp = "Taxable amount based on the selection is : " + str(tax_amt)

# set the label (which is created in the following steps) with the display text

label.config(text = disp)

# prepare a root window

root = Tk()

# name the root window

root.title("Tax calculator")

# mention the dimension of root window

root.geometry("300x200")

# initialize the variable as integer

var = IntVar()

# set the integer value to 1 i.e, first radio button selection by default

var.set(1)  

# create buttons and place them in window as required

R1 = Radiobutton(root, text = "Single", variable = var, value = 1)

R1.place(x=50,y=50)

R2 = Radiobutton(root, text = "Married", variable = var, value = 2)

R2.place(x=50,y=80)

R3 = Radiobutton(root, text = "Divorced", variable = var, value = 3)

R3.place(x=50,y=110)

# create button and call the function when this button clicked

calculate_button = Button(root, text="Calculate", command=tax)

calculate_button.place(x=50, y=140)

  

# create another button to close the window

quit_button = Button(root, text="Quit", command=root.quit)

quit_button.place(x=130, y=140)

# create a label and place it so that the display text in window is displayed as expected

label = Label(root)

label.place(x=20, y=20)

# call mainloop() to start the event

root.mainloop()

________________________________

Add a comment
Know the answer?
Add Answer to:
Add radio button options for filing status to the tax calculator program of Project 1. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Instructions: Add radio button options for filing status to the tax calculator program of Project 1....

    Instructions: Add radio button options for filing status to the tax calculator program of Project 1. The user selects one of these options to determine the tax rate. The Single option’s rate is 20%. The Married option is 15%. The Divorced option is 10%. The default option is Single. Be sure to use the field names provided in the comments in your starter code. Given Code: It also gives us the code for a module but that is like 3000...

  • X Programming Exercise 8.6 | Instructions breezypythongui.py taxformwithgui.py + Q Desktop + ve Add radio button...

    X Programming Exercise 8.6 | Instructions breezypythongui.py taxformwithgui.py + Q Desktop + ve Add radio button options for filing status to the tax calculator program of Project 1. The user selects one of these options to determine the tax rate. The Single option's rate is 20%. The Married option is 15%. The Divorced option is 10%. The default option is Single. 1 2 File: taxformwithgui.py 3 Project 8.6 4 A GUI-based tax calculator. 5 6 Computes and prints the total...

  • Problem 1-11 The Tax Formula for Individuals, Filing Status and Tax Computation, The Standard Deduction (LO...

    Problem 1-11 The Tax Formula for Individuals, Filing Status and Tax Computation, The Standard Deduction (LO 1.3, 1.5, 1.7) Christine is a single 50-year-old taxpayer with no dependents. Her only income is $40,750 of wages. Calculate her taxable income and her tax liability. Table for the standard deduction Filing Status Standard Deduction Single $ 12,200 Married, filing jointly 24,400 Married, filing separately 12,200 Head of household 18,350 Qualifying widow(er) 24,400 Click here to access the tax tables. Taxable income: ?...

  • Problem 1-8 The Tax Formula for Individuals, Filing Status and Tax Computation, Personal and Dependency Exemptions...

    Problem 1-8 The Tax Formula for Individuals, Filing Status and Tax Computation, Personal and Dependency Exemptions (LO 1.3, 1.5, 1.7) Jonathan is a 35-year-old single taxpayer with adjusted gross income in 2019 of $46,300. He uses the standard deduction and has no dependents. Table for the standard deduction Filing Status Standard Deduction Single $ 12,200 Married, filing jointly 24,400 Married, filing separately 12,200 Head of household 18,350 Qualifying widow(er) 24,400 Click here to access the tax tables. a. Calculate Jonathan's...

  • Problem 1-5 The Tax Formula for Individuals, Filing Status and Tax Computation, The Standard Deduction (LO...

    Problem 1-5 The Tax Formula for Individuals, Filing Status and Tax Computation, The Standard Deduction (LO 1.3, 1.5, 1.7) Diego, age 28, married Dolores, age 27, in 2018. Their salaries for the year amounted to $47,230 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income amounted to $2,000; their itemized deductions were $16,000, and they have no dependents. Table for the standard deduction Filing Status 2018 Standard Deduction Single $ 12,000 Married, filing jointly...

  • (python only) Write a program that asks the user for their filing status (single or married)...

    (python only) Write a program that asks the user for their filing status (single or married) and their taxable income. Then, using the below table, compute the tax owed and display the filing status, taxable income, and tax owed. If the filing status is single and the taxable income is overbut not over   the tax is of the amount over$0$9,52510%0$9,526$38,700$952.50 + 12%$9,525$38,701$82,500$4,453.50 +22% $38,700 $82,501unlimited$14,089.50 +24% $82,500 If the filing status is married filing jointly and the taxable income is overbut...

  • Tax Calculator (conditional flow control) MATLAB Tax Calculator (conditional flow control) 0 solutions submitted (max: Unlimited) The simplest income tax calculation for a single person filing federa...

    Tax Calculator (conditional flow control) MATLAB Tax Calculator (conditional flow control) 0 solutions submitted (max: Unlimited) The simplest income tax calculation for a single person filing federal income taxes in the United States involves applying a standard deduction, personal exemption and marginal tax rates to the annual income of the taxpayer. For tax year 2015, the standard deduction for an individual wasメ300 and the personal exemption was >44Mn, The 2015 tax rates vary by income bracket and are given in...

  • Which of the following is not a legitimate filing status for income tax purposes?    a.  ...

    Which of the following is not a legitimate filing status for income tax purposes?    a.   Single     b.   Head of household     c.   Married filing jointly     d.   Widower Which of the following is not a business entity type used in the United States?    a.   C Corporation     b.   Family Limited Partnerships     c.   Family Proprietorship     d.   S Corporation Which of the following is an advantage of a sole proprietorship?    a.   Ease to sell business assets...

  • Tax Liability Calculation, Marginal and Average Tax Rates for Various Filing Status (LO. 1) A taxpayer...

    Tax Liability Calculation, Marginal and Average Tax Rates for Various Filing Status (LO. 1) A taxpayer has $95,000 of taxable income for the current year. Determine the total tax, the marginal tax rate, and the average tax rate if the taxpayer is a a. Single individual b. Married couple filing jointly C. Corporation Do not round intermediate computations. Round total taxes to two decimal places. When required, round tax rates to two decimal places. Refer to the tax rate schedule...

  • Tax Accounting Tax Liability Calculation, Marginal and Average Tax Rates for Various Filing Status (LO. 1)...

    Tax Accounting Tax Liability Calculation, Marginal and Average Tax Rates for Various Filing Status (LO. 1) A taxpayer has $93,080 of taxable income for the current year. Determine the total tax, the marginal tax rate, and the average tax rate if the taxpayer is a a. Single individual b. Married couple filing jointly c. Corporation Do not round Intermediate computations. Use the 2019 tax rate schedule. Do not round your intermediate calculations. Round your final answers to two decimal places...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT