[go: up one dir, main page]

0% found this document useful (0 votes)
2 views2 pages

OOPS Assignment Final

The document outlines a programming assignment with a total of 100 marks due on May 10, 2025. It includes ten tasks that involve creating classes, implementing inheritance, polymorphism, encapsulation, and interfaces in object-oriented programming. Each task requires specific implementations and demonstrations of various programming concepts such as method overriding, constructor chaining, and thread safety.

Uploaded by

Rø Nî N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

OOPS Assignment Final

The document outlines a programming assignment with a total of 100 marks due on May 10, 2025. It includes ten tasks that involve creating classes, implementing inheritance, polymorphism, encapsulation, and interfaces in object-oriented programming. Each task requires specific implementations and demonstrations of various programming concepts such as method overriding, constructor chaining, and thread safety.

Uploaded by

Rø Nî N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Submission Link: https://forms.

gle/DUfBofaPGuKBDpyg8

Full Marks : 100

Last Date : 10th May, 2025

1.
Create a class Vehicle with attributes speed and fuel. Extend it to a class Car with additional attribute
numberOfDoors. Override a method displayDetails() in both classes to show class-specific
information.
Test how overridden methods behave when called through parent class references.

2.
Design a multilevel inheritance hierarchy: Person → Employee → Manager. Each class should have
specific fields and methods. Demonstrate constructor chaining and method overriding.

3.
Create a base class Shape with an abstract method area(). Implement this in Circle, Rectangle, and
Triangle subclasses. Write a program to accept shapes and print area using runtime polymorphism.

4.
Implement a class Printer with overloaded print() methods for different parameter types: String, int,
and double. Demonstrate compile-time polymorphism in action.

5.
Create a class Animal with a method makeSound(). Extend it with Dog and Cat classes overriding the
method. Create a method playSound(Animal a) that takes any Animal object and plays the sound.
Explain the role of dynamic binding in your implementation.

6.
Write a class Student with private fields name, rollNumber, and marks. Provide public getters and
setters. Ensure that marks can only be between 0 and 100 using validation logic. Demonstrate
encapsulation.

7.
Create a class BankAccount that encapsulates accountNumber and balance. Add thread-safe deposit
and withdraw methods using synchronized. Write a test class that simulates multiple threads
accessing the account.
8.
Create an abstract class Appliance with methods turnOn() and turnOff(). Extend it with classes Fan
and Light. Use a main class to demonstrate abstraction by operating on objects via the abstract class
reference.

9.
Create an interface PaymentGateway with method processPayment(double amount). Implement it in
CreditCardPayment and UPIPayment classes. Demonstrate abstraction by calling both
implementations using the interface type.

10.
Design an interface RemoteControl with methods turnOn(), turnOff(), and changeChannel(int).
Implement it in a class SmartTV. Write a test program where RemoteControl references control the
SmartTV.

You might also like