18-02-2025-Lab Task 1
18-02-2025-Lab Task 1
Department of CS & IT
Object Oriented Programming Lab Tasks
Instructor Name: Miss Iqra Adnan Course Code: CS02203 | 11
Course Title: Object Oriented Programming
Student Name: University ID:
PART A
1. Write a program to add two integers. Make a function add() to add integers and display
sum in main function.
2. Write a program that takes input a number in main function and passes the number to a
function. The function will display the factorial of that number.
3. Write a function ‘sum’ to add the values for three variables and store the result in
another variable. Function will take 3 arguments as default. Call the function in main
with 1,2, and 3 variables.
PART B
1. Take values of length and breadth of a rectangle from user and check if it is square or not.
2. Take two int values from user and print greatest among them.
3. A shop will give discount of 10% if the cost of purchased quantity is more than 1000.
Ask user for quantity. Suppose, one unit will cost 100. Judge and print total cost for user.
4. A university has following rules for grading system
a. 85 to 100 – A+
b. 80 to 84 – A
c. 75 to 79 – B+
d. 70 to 74 – B
e. 65 to 69 – C+
f. 60 to 64 – C
g. 55 to 59 – D+
h. 50 to 54 – D
i. Below 50 – F
Ask user to enter marks and print the corresponding grade
5. Take input of age of 3 people by user and determine oldest and youngest among them
6. Write a program to take the value from the user as input. Value can be any alphabet.
Check whether it is vowel or consonant. Using the switch statement
7. Write a program to take the value from the user as an input week number and print
weekday by using the switch statement.