Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Adil Ashraf Roll No# 001

SIR SYED UNIVERSITY OF


ENGINEERING & TECHNOLOGY

Department of Computer Science & Information


Technology
PROGRAMMING FUNDAMENTALS (CS-116T)
Assignment -2
Semester # 01
Max Marks: 3
Instruction: • Attempt all questions
Roll No: 2022F-BCS-001
Section: A
Teacher : Haris Ahmed
Question 1:
Programming Fundamental (Theory)
Adil Ashraf Roll No# 001

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:

Programming Fundamental (Theory)


Adil Ashraf Roll No# 001

Output:

Programming Fundamental (Theory)


Adil Ashraf Roll No# 001

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:

Programming Fundamental (Theory)


Adil Ashraf Roll No# 001

Output:

Programming Fundamental (Theory)


Adil Ashraf Roll No# 001

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:

Programming Fundamental (Theory)


Adil Ashraf Roll No# 001

Output:

Programming Fundamental (Theory)

You might also like