phyton 3#use if, elif or else In a company, the net salary of employees is a function of two discounts: the social security contribution and the income tax. Given the employee's gross salary, social security contributions are paid according to the following table: Gross salary aliquot Up to $ 1,659.38 8% From $ 1,659.39 to $ 2,765.66 9% From $ 2,765.67 to $ 5,531.31 11% Above $ 5,531.31 Fixed discount of $ 608.44 After discounting the social security contribution, the remaining amount is then used to calculate the income tax discount, based on this table: Base salary Discount rate Up to $ 1,903.98 Exempt From $ 1,903.99 to $ 2,826.65 7.5% From $ 2,826.66 to $ 3,751.05 15% From $ 3,751.06 to $ 4,664.68 22.5% 22.5% Above $ 4,664.68 27.5% Write a program that reads a person's gross salary and applies both discounts. As an output, print the following: Net salary = $ X Tips First calculate the social security contribution and discount the gross salary. Then use the remaining amount to determine the income tax discount. Finally, subtract that amount and determine the net salary amount. Use the round (x, n) command to round the answer x to 2 decimal places. Use the logical operator (and) to compare differences Input and Output >>Examples Input : $ 5000.00 ; Output: Net salary = $ 3448.75 Input: $ 1550.00; Output: Net salary = $ 1426.0
phyton 3#use if, elif or else
In a company, the net salary of employees is a function of two discounts: the social security contribution and the income tax. Given the employee's gross salary, social security contributions are paid according to the following table:
|
aliquot |
Up to $ 1,659.38
|
8%
|
From $ 1,659.39 to $ 2,765.66
|
9%
|
From $ 2,765.67 to $ 5,531.31 | 11%
|
Above $ 5,531.31
|
Fixed discount of $ 608.44
|
After discounting the social security contribution, the remaining amount is then used to calculate the income tax discount, based on this table:
Base salary
|
Discount rate
|
Up to $ 1,903.98
|
Exempt
|
From $ 1,903.99 to $ 2,826.65
|
7.5%
|
From $ 2,826.66 to $ 3,751.05 | 15%
|
From $ 3,751.06 to $ 4,664.68 22.5%
|
22.5% |
Above $ 4,664.68
|
27.5% |
Write a program that reads a person's gross salary and applies both discounts. As an output, print the following: Net salary = $ X
Tips First calculate the social security contribution and discount the gross salary. Then use the remaining amount to determine the income tax discount. Finally, subtract that amount and determine the net salary amount. Use the round (x, n) command to round the answer x to 2 decimal places. Use the logical operator (and) to compare differences
Input and Output >>Examples Input : $ 5000.00 ; Output: Net salary = $ 3448.75
Input: $ 1550.00; Output: Net salary = $ 1426.0
Step by step
Solved in 3 steps with 2 images