CS3381 Object Oriented Programming Laboratory
Ex No.: 1
To create simple java programs using classes, arrays and understand the working of
the classes and objects.
1. Swapping of two numbers with and without temporary variable.
2. Find the biggest of 3 numbers.
3. Write a Java program to read 5 subject marks of a student and calculate the
total and grade. The grade system is as follows.
Letter Grade Points Marks Range
O (Outstanding) 10 91 – 100
A+ (Excellent) 9 81 – 90
A (Very Good) 8 71 – 80
B+ (Good) 7 61 – 70
B (Average) 6 50 – 60
RA 0 < 50
4. Develop a java code to find a given number is Prime number or not.
5. Write a Java program which performs the various calculator operations using a
menu-driven approach using switch case statement.
1. Addition
2. Multiplication
3. Division
4. Square root
6. Write a java program to calculate factorial of a given number.
7. Write a java program to display Fibonacci series of given length.
8. Write a java program to add two complex numbers.
9. Write a java program to find the sum of array elements.
10. Write a java program to find the maximum & minimum element in an array.
11. Write a Java Program to Count Number of Digits in an Integer
12. Write a java program to print the following pattern.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6