# a6q3 - CS 116 Assignment 6 Question 3 Ru Wang r46wang...

This preview shows pages 1–2. Sign up to view the full content.

## CS 116 Assignment 6 Question 3 ## Ru Wang r46wang 20319247 ## From assignment template: ## Helper function used for testing functions involving ## floating point numbers ## close: (union float int) (union float int) -> Boolean ## consumes two numbers and produces True if their absolute value ## differs by less than 0.000001, False otherwise. ## examples: close(1.2345674, 1.2345681) => True ## close(1.234, 1.2345) => False def close(x,y): return abs(x-y) < 0.000001 ## fed_tax_due: float[non-negative] -> float[non-negative] ## Purpose: to calculate the total amount of tax due by consuming a non-negative float representing taxable income and produces another non-negative float representing the total tax due. ## Examples: ## fed_tax_due(0) => 0 ## fed_tax_due(40726) => 6108.90 ## fed_tax_due(81452) => 15068.62 ## fed_tax_due(126264) => 26718.74 ## fed_tax_due(30000) => 4500.00 ## fed_tax_due(70000) => 12549.18 ## fed_tax_due(90000) => 17291.70 ## fed_tax_due(300000) => 77103.18 def fed_tax_due(taxable):

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

a6q3 - CS 116 Assignment 6 Question 3 Ru Wang r46wang...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online