CSL37 OOP Question Bank 2021
CSL37 OOP Question Bank 2021
The Invoice class, design as shown in the class diagram, composes a Customer instance (written
earlier) as its member. Write the codes for the Invoice class and a test driver to test all
the public methods.
7. We are required to model students and teachers in our application. We can define a superclass called Person to store
common properties such as name and address, and subclasses Student and Teacher for their specific properties. For
students, we need to maintain the courses taken and their respective grades; add a course with grade, print all courses
taken and the average grade. Assume that a student takes no more than 30 courses for the entire program. For
teachers, we need to maintain the courses taught currently, and able to add or remove a course taught. Assume that
a teacher teaches not more than 5 courses concurrently.
3. Write a java program to throw a exception (checked) for an employee details• If an employee name is a
number, a name exception must be thrown. If an employee age is greater than 50, an age exception must be
thrown. Or else an object must be created for the entered employee details.
4. Write a Java program to find area of a triangle with three sides a, b, c. A triangle can be formed only if a+b>c,
b+c>a, c+a>b. First verify whether the above three conditions are satisfied. If any one of them is not satisfied
then throw an exception called ValidateTriangle Exception
Enter the 3 sides of triangle:
7 4 10
Valid Triangle
Enter the 3 sides of triangle:
268
Not a valid triangle
5. Write a Java program to display multiplication table of 8 & 9 using shared resources “synchronized
displayTable(intnum)”. The table should be displayed with 1 sec delay between every number. First print
multiplication table of 8 and then 9.
6. Write a Java program to implement "ADDTION" and "MULTIPLICATION" of two numbers using Lambda
Expressions
7. Write a java program to accept a string. Convert the string to uppercase. Count and output the number of
double letter sequences that exist in the string.
Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE”
Sample Output: 4
Note:
Write up : 08 Marks
Conduction and Result : 35 Marks (a: 20 Marks, b: 15 Marks)
Viva : 07 Marks
For Change of question : 5+5 Marks