โฑ๏ธ Time: 2 Hours
๐ Maximum Marks: 50
๐ Instructions (Very Important):
- Attempt all questions.
- Programs in this paper may require multiple classes working together.
- Follow proper OOP design (modular classes, reuse, clarity).
- Use Scanner class for input wherever required.
- Output must be well-structured and labeled.
- Add comments explaining logic and OOP usage.
๐น Section A โ Integrated Core System (30 Marks)
Q1. Case Study: Online Shopping System (15 Marks)
You are required to design a simple online shopping system using OOP concepts.
๐ Program Requirements:
Step 1: Create a class Product
- Data members:
- productId (int)
- productName (String)
- price (double)
- Create:
- Parameterized constructor
- Method
displayProduct()
Step 2: Create a class Cart
- Data members:
- quantity (int)
- Create methods:
calculateTotal(Product p)- Total = product price ร quantity
Step 3: Create a class Discount
- Method
applyDiscount(double totalAmount)- If amount > 1000 โ 10% discount
- Otherwise โ no discount
Step 4: Main Method Requirements:
- Take input:
- Product details
- Quantity
- Perform:
- Display product details
- Calculate total amount
- Apply discount
- Display final bill
๐ Expected Output Format:
Product: Laptop
Price: 50000
Quantity: 1
Total: 50000
Discount Applied: 5000
Final Amount: 45000
Q2. Case Study: Bank System with Encapsulation (15 Marks)
Design a simple banking system using encapsulation and multiple methods.
๐ Program Requirements:
Step 1: Create class BankAccount
- Private variables:
- accountNumber
- accountHolderName
- balance
Step 2: Provide:
- Getter and Setter methods
- Validation:
- Balance cannot be negative
Step 3: Create methods:
deposit(double amount)withdraw(double amount)- Only if balance is sufficient
displayAccountDetails()
Step 4: Main Method:
- Create account object
- Set values
- Perform:
- Deposit
- Withdrawal
- Display final account details
๐ Output must clearly show:
- Initial balance
- Transaction details
- Final balance
๐น Section B โ Advanced Integrated OOP (20 Marks)
Q3. Case Study: Employee Management System (10 Marks)
This program must demonstrate Inheritance + Polymorphism.
๐ Requirements:
Step 1: Create base class Employee
- Method
calculateSalary()
Step 2: Create subclasses:
PermanentEmployeeContractEmployee
Step 3: Override method:
- Permanent โ Fixed salary โน40,000
- Contract โ โน500 per day ร 20 days
Step 4: Main Method:
- Use parent class reference
- Assign subclass objects
- Display salary
๐ Must demonstrate:
- Runtime polymorphism
- Clear output
Q4. Case Study: Payment Gateway using Interface (10 Marks)
This program must demonstrate Interface-based design.
๐ Requirements:
Step 1: Create interface PaymentGateway
- Method
pay(double amount)
Step 2: Implement in:
CreditCardUPI
Step 3: Define behavior:
- CreditCard โ print payment success message
- UPI โ print payment success message
Step 4: Main Method:
- Use interface reference
- Perform payments using both methods
๐ Output must clearly show:
- Payment method used
- Amount paid
โญ Bonus Question (Optional โ 5 Marks)
Q5. Exception Handling in Integrated System
๐ Modify any one of the above programs to:
- Handle invalid input:
- Negative values
- Wrong data type
- Use:
try-catchfinally
- Display: