Object Oriented Programming
SWE · Quiz · Summer 26
Paper 3 of 6By Md. Mehedi Hasan (1)Switch
Paper 3 of 6
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Software Engineering
Course Code: SE216; Course Title: Object Oriented Programming
Time: 40 Mins
Marks: 15
1. a) Explain the difference between method overloading and method overriding with examples. [3]
b) Analyze the following class diagram into appropriate Java code by correctly implementing inheritance and method overriding. Create one object of the final subclass, invoke all necessary methods, and display the output. [7]
Expected Output:
Introduction to Computing
Object Oriented Programming
Advanced Python
[Figure: Class diagram with base class containing +courseTitle : String, +instructor : String, +setCourseData(String, String) : void, +display() : void; extended by OOP Course containing +credit : int, +setCredit(int) : void, +display() : void; extended by Advanced Course containing +specialization : String, +setSpecialization(String) : void, +display() : void]
c) Suppose you are developing a UserAccount class for a basic account management system. [5]
Each UserAccount object must store the following information:
• Username (String)
• Account balance (double)
To ensure data security and integrity, the following conditions must be satisfied:
• The username and account balance must not be accessible or modifiable directly from outside the class.
• Controlled access should be provided to assign and retrieve these values.
• Any modification to the account balance should happen only through defined methods.
Analyze the scenario implementing the UserAccount class in Java using proper access control mechanisms and demonstrate how external classes can interact with the object without directly accessing its data members.
Note: Write the complete Java program, including the main method.