Professional Documents
Culture Documents
PF T Asssignment 02
PF T Asssignment 02
You are an accountant setting up a payroll system based on Table, which shows five different ranges for
salaries up to Rs.150, 000.00. Each table line shows the base tax amount (column2) and tax percentage
(column3) for a particular salary range (column1).
Write a function that taken person’s salary and calculate the tax due by adding the base tax to the product
of the percentage times the excess salary over the minimum salary for that range.
Source code:
Output:
Question 2:
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an
additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge
for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time.
Write a program that calculates and prints the parking charges for each of three customers who
parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your
program should print the results in a neat tabular format and should calculate and print the total of
yesterday’s receipts. The program should use the function calculateCharges to determine the charge
for each customer. Your outputs should appear in the following format:
Source code:
Output:
Question 3:
Show the value of x after each of the following statements is performed:
a) x = fabs( 7.5 )
b) x = floor( 7.5 )
c) x = fabs( 0.0 )
d) x = ceil( 0.0 )
e) x = fabs( -6.4 )
f) x = ceil( -6.4 )
g) x = ceil( -fabs( -8 + floor( -5.5 ) ) )
Source code:
Output: