please answer this question using python 3. Submit function: reads the five inputs, calls the functions listed below as needed, and displays tax. Inputs # of jobs: income : # of children: Is Married?: Is Student? : Outputs: tax   functions Required 1. count_regular_exemptions() Calculates number of regular exemptions. Everyone starts with one exemption If no jobs, you get one more exemption If you have one job: You get one more exemption if you are married, or if you are a single student. If you have more than one job: You get one more exemption if your income is less than 1500.   2. count_child_exemptions() Calculates number of child credit exemptions. If your income is less than $70,000 : You get 4 times the number of children as the number of exemptions. Example: income 60,000 with 3 children: 4 * 3 = 12 exemptions If your income is at or above $70,000 : You get one additional exemption for every 2 kids. That is: 0 exemptions for 1 child, 1 for 2 children, 1 for 3, 2 for 4 and 5 children, 3 for 6 and 7 children, etc.   3. compute_taxable_income() Calculates the taxable income. Each child exemption is worth $1000. Each regular exemption is worth $2000. exemption amount is the sum of child exemption amount and regular exemption amount, each computed using the counts and unit exemptions above. Taxable income = Income - Exemption amount 4. compute_tax_rate Determine tax rate based on taxable income. Find the tax rate based on the table below. Rate Single Married 10% Up to,including, 38,000 Up to and including $78,000 15% Above 38,000 Above 78,000 tax is determined using taxable income and tax rate.   5. compute_deduction Calculate deduction amount to be subtracted from tax. Deduction amount starts at 0 dollars. if student and income < $80,000: $2000 if student and income < $57,000: $3000 The income referred to above is the ‘income’ input by the user. Not taxable income. tax is updated by subtracting any deduction amount from tax.   If tax < 0: set tax due to $0.00. Output format: Your estimated taxes due are: $XXXX Summary: Show average tax for students, and the number of taxpayers. Use a function to compute the average. Reset: Getting ready for a new series of inputs. Additional features: revisit and optimize the if statements to be as efficient as possible Include counts of: married students, single students, and non-student taxpayers in summary   #main quit = False while not quit:    print('1.Submit 2.Summary 3.Reset 4.Exit')    choice = int(input('Enter choice: '))    if choice == 1:        submit()    elif choice == 2:        summary()    elif choice == 3:        reset()    elif choice == 4:        quit = True    else:        print('Invalid Choice!')

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

please answer this question using python 3.

Submit function:

reads the five inputs, calls the functions listed below as needed, and displays tax.

Inputs

# of jobs:

income :

# of children:

Is Married?:

Is Student? :

Outputs: tax

 

functions Required

1. count_regular_exemptions()

Calculates number of regular exemptions.

  1. Everyone starts with one exemption
  2. If no jobs, you get one more exemption
  3. If you have one job:

You get one more exemption if you are married, or if you are a single student.

  1. If you have more than one job:

You get one more exemption if your income is less than 1500.

 

2. count_child_exemptions()

Calculates number of child credit exemptions.

  1. If your income is less than $70,000 : You get 4 times the number of children as the number of exemptions. Example: income 60,000 with 3 children: 4 * 3 = 12 exemptions
  2. If your income is at or above $70,000 : You get one additional exemption for every 2 kids. That is: 0 exemptions for 1 child, 1 for 2 children, 1 for 3, 2 for 4 and 5 children, 3 for 6 and 7 children, etc.

 

3. compute_taxable_income()

Calculates the taxable income.

Each child exemption is worth $1000.

Each regular exemption is worth $2000.

exemption amount is the sum of child exemption amount and regular exemption amount, each computed using the counts and unit exemptions above.

Taxable income = Income - Exemption amount

4. compute_tax_rate

Determine tax rate based on taxable income.

Find the tax rate based on the table below.

Rate

Single

Married

10%

Up to,including, 38,000

Up to and including $78,000

15%

Above 38,000

Above 78,000

tax is determined using taxable income and tax rate.

 

5. compute_deduction

Calculate deduction amount to be subtracted from tax.

Deduction amount starts at 0 dollars.

  1. if student and income < $80,000: $2000
  2. if student and income < $57,000: $3000

The income referred to above is the ‘income’ input by the user. Not taxable income.

tax is updated by subtracting any deduction amount from tax.

 

If tax < 0: set tax due to $0.00.
Output format: Your estimated taxes due are: $XXXX

Summary:
Show average tax for students, and the number of taxpayers. Use a function to compute the average.

Reset: Getting ready for a new series of inputs.

Additional features:

  • revisit and optimize the if statements to be as efficient as possible
  • Include counts of: married students, single students, and non-student taxpayers in summary

 

#main

quit = False

while not quit:

   print('1.Submit 2.Summary 3.Reset 4.Exit')

   choice = int(input('Enter choice: '))

   if choice == 1:

       submit()

   elif choice == 2:

       summary()

   elif choice == 3:

       reset()

   elif choice == 4:

       quit = True

   else:

       print('Invalid Choice!')

Expert Solution
Step 1: Here is the algorithm of the code:
  1. Initialize the following variables:
    • num_married_students = 0
    • num_single_students = 0
    • num_non_student_taxpayers = 0
    • total_tax_students = 0
    • total_tax_taxpayers = 0
  1. Define a function count_regular_exemptions that takes num_jobs, income, is_married, and is_student as input. a. Set exemptions to 1. b. If num_jobs is 0, increment exemptions by 1. c. If num_jobs is 1:
    • If is_married or is_student is true, increment exemptions by 1.
    • If income is less than 1500, increment exemptions by 1. d. If num_jobs is greater than 1 and income is less than 1500, increment exemptions by 1. e. Return the calculated exemptions.
  1. Define a function count_child_exemptions that takes income and num_children as input. a. If income is less than 70000, return 4 times the number of children. b. Otherwise, return the integer division of num_children by 2.
  2. Define a function compute_taxable_income that takes income and exemptions as input. a. Calculate the child_exemption_amount as 1000 times the child exemptions. b. Calculate the regular_exemption_amount as 2000 times the regular exemptions. c. Calculate the total_exemption_amount as the sum of child_exemption_amount and regular_exemption_amount. d. Return the difference between income and total_exemption_amount as the taxable income.
  3. Define a function compute_tax_rate that takes taxable_income and is_married as input. a. If is_married is true and taxable_income is less than or equal to 78000, return 0.10. b. If is_married is true and taxable_income is greater than 78000, return 0.15. c. If is_married is false and taxable_income is less than or equal to 38000, return 0.10. d. If is_married is false and taxable_income is greater than 38000, return 0.15.
  4. Define a function compute_deduction that takes is_student and income as input. a. Set deduction_amount to 0. b. If is_student is true and income is less than 80000, set deduction_amount to 2000. c. If is_student is true, income is less than 57000, and deduction_amount is already set to 2000, update deduction_amount to 3000. d. Return the deduction_amount.
  5. Define a function submit that takes no input. a. Within submit: i. Prompt the user for input: num_jobs, income, num_children, is_married, and is_student. ii. Calculate exemptions using count_regular_exemptions and count_child_exemptions functions. iii. Calculate taxable_income using compute_taxable_income function. iv. Calculate tax_rate using compute_tax_rate function. v. Calculate tax as taxable_income multiplied by tax_rate. vi. Calculate deduction using compute_deduction function. vii. Subtract deduction from tax and ensure it is non-negative. viii. Display the estimated taxes due. ix. Update counts and total tax for the summary.
  6. Define a function summary that takes no input. a. Within summary: i. Calculate the average tax for students and display it. ii. Display the number of taxpayers - married students, single students, and non-student taxpayers, and the total count.
  7. Define a function reset that takes no input. a. Within reset: i. Reset all count variables to 0.
  8. Implement the main program using a while loop: a. Display a menu with options for submission, summary, reset, and exit. b. Prompt the user for a choice. c. Based on the user's choice, call the appropriate function: submit, summary, reset, or exit the program. d. Handle invalid choices by displaying an error message.

  9. End the algorithm.



steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education