[go: up one dir, main page]

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

Assignment 1

Uploaded by

Abdullah Afzal
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)
8 views2 pages

Assignment 1

Uploaded by

Abdullah Afzal
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

BS(CS)V1.

FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY


Department: Computer Science Program: BS

OBJECT ORIENTED PROGRAMMING

Due Date: 25-11-24 Max Marks: 5

Assignment # 1

Mapped CLO Mapped GA Mapped Learning Level SDG

GA 2
C3
CLO2 (Knowledge for Solving 4
(Applying)
Computing Problems)

Question # 01

Ali Daniyal, the owner of a neighborhood store, has approached you to develop a simple
inventory management system to streamline his store operations. Your task is to design and
implement this system using advanced object-oriented programming concepts in Java.
Additionally, you need to create a UML class diagram to represent the structure of your
solution.

The store sells items such as electronics, groceries, and clothing. Each item in the store has
the following attributes:

• Item Name
• Item Code (a unique identifier)
• Price
• Quantity in stock

The system should also allow the manager to perform the following actions:

1. Add new items to the inventory.


2. Search for an item in the inventory using the item code.
3. Update the stock of an item.
4. Display the details of all items in the inventory.

Instructions for Implementation

1. UML Class Diagram


a) Create a UML class diagram to represent the structure of your solution.
Include the following:
BS(CS)V1.0

FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY

i. StoreItem class with its attributes and methods.


ii. StoreInventory class, which manages an array of StoreItem
objects.
b) Show relationships and specify access modifiers, data types, and method
signatures.
2. Reference Types and Variables
a) Create a StoreItem class to represent an item in the store.
b) Use appropriate instance variables to store the item's details.
c) Include static variables and methods, if needed, for operations such as
counting the total number of items.
3. Encapsulation and Data Hiding
a) Use private access modifiers for the instance variables of StoreItem.
b) Provide public getter and setter methods to access and modify these
variables.
c) Explain how this ensures data encapsulation and data hiding.
4. Methods and Operations
a) Implement member methods for the following operations:
i. Adding a new item (using method parameters for item details).
ii. Searching for an item by item code.
iii. Updating stock quantity (pass the StoreItem object as a
parameter).
iv. Returning an item’s details (as a string).
5. Method Overloading
a) Overload the constructor of the StoreItem class to allow:
i. Creating an item with default values.
ii. Creating an item by specifying all attributes.
b) Overload a method in the class to display item details in different formats
(e.g., full details vs. just name and price).
6. Array of Objects
a) In a StoreInventory class, create an array of StoreItem objects to
manage the store’s inventory.
b) Write methods to interact with this array, such as adding new items or
searching for an item.
7. Implementation
a) Write a main class (StoreInventoryApp) to:
i. Demonstrate adding, searching, and updating items in the
inventory.
ii. Display the inventory details.

Submission Guidelines

• Submit a Microsoft Word Document file that includes screenshots of the code,
output and UML Class Diagram in a Microsoft Word Document.

You might also like