Professional Documents
Culture Documents
M.Aaman Khan Assignment 2 Roll No 17
M.Aaman Khan Assignment 2 Roll No 17
Theory(CS-116T)
Assignment #2
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 ) ) )
a) x = fabs( 7.5 )
Source Code:
Output:
b) x = floor( 7.5 )
Source Code:
Output:
c) x = fabs( 0.0 )
Source Code:
Output:
d) x = ceil( 0.0 )
Source Code:
Output:
e) x = fabs( -6.4 )
Source Code:
Output:
f) x = ceil( -6.4 )
Source Code:
Output:
Output: