๐Ÿงพ Java OOP Practical Exam โ€“ Set 10 (Integrated System Based)

โฑ๏ธ 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:

  • PermanentEmployee
  • ContractEmployee

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:

  • CreditCard
  • UPI

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:

  1. Handle invalid input:
    • Negative values
    • Wrong data type
  2. Use:
    • try-catch
    • finally
  3. Display:

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *