KEMBAR78
Java Assignment 2025 | PDF | Method (Computer Programming) | Class (Computer Programming)
0% found this document useful (0 votes)
6 views4 pages

Java Assignment 2025

Uploaded by

adefault720
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)
6 views4 pages

Java Assignment 2025

Uploaded by

adefault720
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/ 4

Techno India Hooghly Campus

Object Oriented Programming Lab Assignment (BCAC592)


Last Date of Submission: 29/08/2025
1.
Name:
2.

University Roll Number:

Instruction: Assignments must be handwritten in A4 Page with Problem Number,


Program and Sample Output. Everyone must write their Name and University roll number
on this page and attach it in front of the assignment.

1. Library Management – Book Borrowing System


Objective: Create a small library management system to allow a user to borrow and return books.

Requirements:

- Create three classes:

1. Book – stores details like title, author, and availability status.


2. Use private variables and public getter/setter methods for access.
3. Member – stores details of a library member (name, member ID). Initialize using a
constructor.
4. Library – manages a list of books and member borrowing.

- Features:

• Add books to the library (hardcoded or via user input).

• Allow a member to borrow a book if available.

• Allow a member to return a borrowed book.

- Use constructors to initialize objects.

- Use Scanner for all user input (e.g., book title to borrow).

- Ensure access modifiers are properly used for encapsulation.

Signature of Invigilator with Date


2. Student Report Card Generator
Objective: Generate and display a student’s report card with marks entered by the user.

Requirements:

- Create three classes:

1. Student – stores roll number, name, and class.

2. Subject – stores subject name and marks obtained.

3. ReportCard – calculates total marks, percentage, and grade.

- Steps:

• Use a constructor in Student to initialize name, roll number, and class.

• Create an array of Subject objects to store marks entered using Scanner.

• ReportCard should take a Student object and subject marks, then calculate and display
results.

- Apply access control: student details should be private with getters.

- Output should clearly display a formatted report card.

Signature of Invigilator with Date

3. Bank Account Transaction System


Objective: Simulate a simple bank account with deposit and withdrawal features.

Requirements:

- Create three classes:

1. Account – stores account number, account holder name, and balance.

2. Transaction – performs deposit and withdrawal operations.

3. BankApp – main class with menu for user operations.

- Use constructors to initialize account details.

- Use private for balance and modify only via methods.

- Use Scanner for:

• Creating an account (name, account number, initial deposit).

• Performing transactions.

- Menu Example: Deposit, Withdraw, Show Balance, Exit.

- Include validation: prevent withdrawal beyond available balance.

Signature of Invigilator with Date


4. Online Shopping Cart
Objective: Build a console-based shopping cart where the user can add and remove products.

Requirements:

- Create three classes:

1. Product – stores product ID, name, and price.

2. Cart – stores a list of products selected by the user.

3. ShoppingApp – main class to handle menu and user interaction.

- Use constructors for initializing products.

- Store products in an array or ArrayList.

- Use Scanner to:

• Show available products.

• Add a product to the cart by entering its ID.

• Remove a product from the cart.

- Display total price before checkout.

- Apply access control so product details are accessed via getters.

Signature of Invigilator with Date

5. Vehicle Rental System


Objective: Simulate a vehicle rental system that handles different types of vehicles with varied rental
costs.

Requirements:

- Abstract Class: Create an abstract class Vehicle with:

• String model, String registrationNumber as variables.

• A constructor to initialize these values.

• An abstract method calculateRent(int days).

- Inheritance:

• Car and Bike classes inherit from Vehicle.

• Implement calculateRent() differently for each:

- Car: ₹1000/day

- Bike: ₹400/day

- Method Overloading:

• Overload calculateRent():

- Accept int days → returns rent.


- Accept int days, double discountPercentage → returns rent after discount.

- User Interaction (Scanner):

• Let the user choose a vehicle type, enter rental days, and optionally a discount.

• Display total cost.

- Access Control: Keep variables private and use getters for access.

Signature of Invigilator with Date

6. Shape Area & Perimeter Calculator


Objective: Create a system to calculate area and perimeter of different shapes using abstraction and
method overloading.

Requirements:

- Abstract Class: Create an abstract class Shape with:

• String shapeName variable.

• A constructor to initialize it.

• Abstract methods: calculateArea() and calculatePerimeter().

- Inheritance:

• Circle and Rectangle inherit from Shape.

• Implement abstract methods for each shape.

- Method Overloading:

• In each shape class, overload a setDimensions() method:

- For Circle: setDimensions(double radius)

- For Rectangle: setDimensions(double length, double breadth)

- User Interaction (Scanner):

• Ask user to choose a shape.

• Ask for required dimensions.

• Display area and perimeter.

- Access Control: Use private fields for dimensions and public getters.

Signature of Invigilator with Date

You might also like