Use the following: basic input and output, expressions, variables, and assignments, the math and random libraries, expressions, variables, and assignments; mathematical calculations that do not require the use of a library, Other Python statements cannot be used, e.g. def

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

Use the following: basic input and output, expressions, variables, and assignments, the math and random libraries, expressions, variables, and assignments; mathematical calculations that do not require the use of a library,

Other Python statements cannot be used, e.g. def

Question 4 (hw2_q4.py): Assume you work for a software company writing tax software.
Specifically, your job in quality assurance is to test the program with various inputs and produce
the results to compare to our final product that the customer uses.
Write a program that will randomly select a number of values that represent a user's financial
profile. Calculate the tax owed or to be refunded by the user given these values.
First, the program should randomly create two values representing the user and user's spouses'
income. These values should be in the range of $45,203.03 and $165,286.49 (inclusive). This is
the couple's combined base income.
Next, calculate the total amount of any tip income the couple earned. This value should be
between $0 and $12,340.00 (inclusive). The combined income of the couple is the sum of all
these income values.
From this we need to determine the amount of tax that should be paid on the income. Assume
the tax rate is 28.5% of the base income. This value is essentially what the user and spouse
owes. However, they can receive a $2,500 per child credit. Randomly determine the number of
children in the household (between 0 and 3 inclusive) and deduct this amount from the amount
of tax owed. For example, if the couple owes $4,000 in taxes and has 1 child, then the $2,500
tax credit lowers the amount of tax they owe to be $1,500.
Finally, since the user and spouse have had a portion of their salaries deducted each paycheck
to pay the taxes, we need to calculate each of the amount of taxes paid through payroll
deductions. These amounts are 25.0% of their salary. Calculate each of these amounts and
calculate the total amount of tax paid through payroll deductions.
Our final result (the amount of outstanding tax they or will be refunded in the event of
overpayment) can be calculated by subtracting the amount of tax paid through payroll
deductions from the total amount of tax owed (after deducting the child tax credit).
Confused? Walk through our examples carefully.
Your program should print output in the format shown below. Yes, dollar signs and not more than
two places of precision should be shown for all monetary amounts. Commas are not required for
monetary amounts. Spacing and formatting matter, so replicate our formatting exactly. Print all
results as the program executes (incoming amounts, number of children, etc.), just as we have
done and shown. All values should be rounded prior to performing mathematical calculations on
them, not just before printing.
Transcribed Image Text:Question 4 (hw2_q4.py): Assume you work for a software company writing tax software. Specifically, your job in quality assurance is to test the program with various inputs and produce the results to compare to our final product that the customer uses. Write a program that will randomly select a number of values that represent a user's financial profile. Calculate the tax owed or to be refunded by the user given these values. First, the program should randomly create two values representing the user and user's spouses' income. These values should be in the range of $45,203.03 and $165,286.49 (inclusive). This is the couple's combined base income. Next, calculate the total amount of any tip income the couple earned. This value should be between $0 and $12,340.00 (inclusive). The combined income of the couple is the sum of all these income values. From this we need to determine the amount of tax that should be paid on the income. Assume the tax rate is 28.5% of the base income. This value is essentially what the user and spouse owes. However, they can receive a $2,500 per child credit. Randomly determine the number of children in the household (between 0 and 3 inclusive) and deduct this amount from the amount of tax owed. For example, if the couple owes $4,000 in taxes and has 1 child, then the $2,500 tax credit lowers the amount of tax they owe to be $1,500. Finally, since the user and spouse have had a portion of their salaries deducted each paycheck to pay the taxes, we need to calculate each of the amount of taxes paid through payroll deductions. These amounts are 25.0% of their salary. Calculate each of these amounts and calculate the total amount of tax paid through payroll deductions. Our final result (the amount of outstanding tax they or will be refunded in the event of overpayment) can be calculated by subtracting the amount of tax paid through payroll deductions from the total amount of tax owed (after deducting the child tax credit). Confused? Walk through our examples carefully. Your program should print output in the format shown below. Yes, dollar signs and not more than two places of precision should be shown for all monetary amounts. Commas are not required for monetary amounts. Spacing and formatting matter, so replicate our formatting exactly. Print all results as the program executes (incoming amounts, number of children, etc.), just as we have done and shown. All values should be rounded prior to performing mathematical calculations on them, not just before printing.
Example executions
The user's income is $63069.57
The user's spouse's income is $153514.16
The couple's combined base income is $216583.73
The couple's tip income is $11462.08
The couple's total combined income is $228045.81
The amount of tax owed on $228045.81 is $64993.06
The couple has 4 kid(s). Therefore, the amount of tax owed after the child
tax credit is $54993.06
The user had $15767.39 withheld from their paycheck.
The spouse had $38378.54 withheld from their paycheck.
The total amount withheld from payroll deductions is $54145.93
The couple's tax liability is $847.13
If the above amount is positive, the couple receives a refund.
If the above amount is negative, the couple owes that amount.
The user's income is $146266.31
The user's spouse's income is $95182.9
The couple's combined base income is $241449.21
The couple's tip income is $4700.06
The couple's total combined income is $246149.27
The amount of tax owed on $246149.27 is $70152.54
The couple has 4 kid(s). Therefore, the amount of tax owed after the child
tax credit is $60152.54
The user had $36566.58 withheld from their paycheck.
The spouse had $23795.72 withheld from their paycheck.
The total amount withheld from payroll deductions is $60362.3
The couple's tax liability is $-209.76
If the above amount is positive, the couple receives a refund.
If the above amount is negative, the couple owes that amount.
Transcribed Image Text:Example executions The user's income is $63069.57 The user's spouse's income is $153514.16 The couple's combined base income is $216583.73 The couple's tip income is $11462.08 The couple's total combined income is $228045.81 The amount of tax owed on $228045.81 is $64993.06 The couple has 4 kid(s). Therefore, the amount of tax owed after the child tax credit is $54993.06 The user had $15767.39 withheld from their paycheck. The spouse had $38378.54 withheld from their paycheck. The total amount withheld from payroll deductions is $54145.93 The couple's tax liability is $847.13 If the above amount is positive, the couple receives a refund. If the above amount is negative, the couple owes that amount. The user's income is $146266.31 The user's spouse's income is $95182.9 The couple's combined base income is $241449.21 The couple's tip income is $4700.06 The couple's total combined income is $246149.27 The amount of tax owed on $246149.27 is $70152.54 The couple has 4 kid(s). Therefore, the amount of tax owed after the child tax credit is $60152.54 The user had $36566.58 withheld from their paycheck. The spouse had $23795.72 withheld from their paycheck. The total amount withheld from payroll deductions is $60362.3 The couple's tax liability is $-209.76 If the above amount is positive, the couple receives a refund. If the above amount is negative, the couple owes that amount.
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Literals
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
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