Professional Documents
Culture Documents
Quiz 1
Quiz 1
Quiz-1
for
Object Oriented Programming (OOP)
Quiz-1
Quiz-1 2
Instructions:
● If someone is caught using the internet in this Quiz ,their marks will be reduced to zero.
● In case of Plagiarism, Straight Zero and report this case to DC.
● Late Submission is not allowed. If someone evaluated his/her code then he/she will submit
the code in google classroom and then leave the class.
In this scenario, you are tasked with developing an inventory management system for a warehouse.
Each item in the inventory has attributes such as a unique ID, name, quantity, and price. To
represent each item, you decide to create a class called Item. The inventory data will be stored in a
2D dynamic array of Item objects. You need to implement functions to add, remove, and update
item records, as well as generate reports on inventory status.
Item Class:
Additionally, you will implement getter, setter, constructors and destructors methods for each
attribute to ensure encapsulation and access control.
1. Add Item: Implement a function to add a new item to the inventory. The function should
take the ID, name, quantity, and price of the item as parameters and add it to the 2D
dynamic array.
2. Remove Item: Implement a function to remove an item from the inventory based on its ID.
The function should search for the item with the given ID and remove it from the array if
found.
3. Update Item: Implement a function to update the details of an existing item in the
inventory. The function should take the ID of the item to be updated and new values for its
attributes (name, quantity, and price). It should search for the item with the given ID and
update its details accordingly.
4. Generate Inventory Report: Implement a function to generate a report on the current
status of the inventory. This report should include details such as the ID, name, quantity,
and price of each item in the inventory.
Examples:
Let's consider a few examples to demonstrate how the inventory management system works:
Quiz-1 3
1. Adding an Item:
Input:
Item ID: 001
Item Name: Laptop
Quantity: 10
Price: $800
Output:
Item added successfully!
2. Removing an Item:
Input:
Enter ID of the item to remove: 002
Output:
Item with ID 002 removed successfully!
3. Updating an Item:
Input:
Enter ID of the item to update: 001
New Name: Desktop
New Quantity: 5
New Price: $1000
Output:
Item with ID 001 updated successfully!
Inventory Report: