Ict 2122-Ict - 2122 - Object Oriented Programming
Ict 2122-Ict - 2122 - Object Oriented Programming
A
Answer all the questions.
1A) Create a Die class with one integer instance variable called sideUp. Give it agetSideUp() method (5)
that returns the values of sideUp and a void roll() method that changes sideUpto a random value
from 1 to 6.Then create a DieDemo class with a method that creates two Die objects, rolls them,
and prints the sum of the two sides up.
1B) Explain different types of type conversion in assignments with examples. (3)
1C) (2)
2A) Implement a school management system with a base class Person and derived classes Student (5)
and Teacher. Each Person has a name and age. Student has additional attributes like studentID
and grade, while Teacher has employee ID and subject. Add methods to display details.
2B) Illustrate the use of super keyword with an example. (3)
2C) How method overriding can help to overcome some of the limitations of method overloading? (2)
3A) Create a class Cinema Hall with required variables and methods. Users can book the seat based (5)
on availability. When booking status reaches its full capacity, raise a user defined exception Seats
Full Exception. If two users book different seat numbers, then it is allotted else should generate a
user defined exception called Seat Already Booked Exception. Initially it should display all 80 seat
numbers and finally it should display booking status. While booking the seat, input each user's
name and seat number.
3B) Define a package called 'student' and define a public interface Total in this package as follows. (3)
Page 1 of 2
Define a public class Student with following data members: name, regno, internal, external, in
'marks' package implementing Total interface. Create a main class in 'general' package to
demonstrate Student object with the interface method. Specify filenames, package names, and
imports.
3C) (2)
4A) Write a java program for computing the grades. The program has two modules. The first module (5)
'Internal' takes marks for three courses and attendance per course as input and gives the eligibility
for Endsem only if the attendance is >75%. The second module 'Endsem' takes marks for each of
the 3 courses. The main function calculates the final grades( if total marks >90, the A+, else A) once
both the Internal and Endsem modules complete. Ensure that Internal and Endsem modules must
be executed in parallel however Endsem module can complete its task only after it receives
eligibility per course. Once both the modules finish their computation the main function calculates
the grade and displays it.
4B) Why generics is type safe? Illustrate with a suitable example. (3)
4C) With a suitable example, explain the process of modifying the priority of a given thread in a program (2)
and discuss the impact of priority changes on thread execution.
5A) Create a GUI application with a user interface as shown in below figure using JavaFX. The (5)
application should take 2 strings as input. On click of a button, it should compare the 2 strings. If
two strings are equal, then display "Strings are equal" in a label (Display Result Here) otherwise
display the position of first mismatch.
5B) Why does the CERT Java standard recommend that methods performing security checks be (3)
declared private or final? Provide an example to illustrate the risk with compliant and non-compliant
code.
5C) Illustrate the working of a Border Pane layout with an appropriate code. (2)
-----End-----
Page 2 of 2