



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Course Name: Bachelor of Science in Computer Science (BSCS) Unit / Subject Name: Object Oriented Programming Trainerās Name: Ms. Shumaila Qayyum Assignment No: 2 Student Name: Ammar Azmat Student ID/Roll No.: 3297 Student Name: M. Ayyaz Khan Student ID/Roll No.: 3293 Submission Date: ļ¶ ASSESSOR USE ONLY: Result: Assignment 2 o Satisfactory o Not Satisfactory Feedback: Feedback is given to the student on each Assessment task & final outcome of the unit Yes / No Assessorās Feedback: Assessorās Signature: Date:
ļ¶ ASSESSMENT FIRST SUBMISSION/RE-SUBMISSION RECEIPT: It is studentās responsibility to keep the assessment submission receipt as a proof of submission of assessment tasks. Student Names: Ammar Azmat & M. Ayyaz Khan Student ID /Roll No.: 3297 & 3293 Unit / Subject Code: Object Oriented Programming Assignment No.: 2 Trainer Name: Ms. Shumaila Qayyum Date: Signature: Assessorās Signature: Date:
You are developing a simple Product Inventory System for a retail store. Each product has a unique product code, a name, a price, and a quantity in stock. The system should be able to perform operations like updating the stock quantity, displaying product details, and calculating the total value of the inventory. Additionally, there should be a mechanism to track the total number of products in the inventory.
1. Define a Product class with the following attributes: productCode, productName, price, and quantityInStock. 2. Implement constructors with overloading properties for the Product class. 3. Implement multiple methods with overloading for the Product class. Implement Static Variables and Functions to keep record of total products.
ļ· Attributes of the product class: o productCode o productName o price o quantityInStock ļ· Constructors with overloading properties for the Product class: There are two constructors provided: o One constructor accepts parameters for all attributes (productCode, productName, price, quantityInStock). o Another constructor accepts parameters for all attributes except quantityInStock, initializing it to 0 by default. ļ· Multiple methods with overloading for the Product class: o updateStock(int quantity): Updates the stock quantity of the product. o displayProductDetails(): Displays the details of the product including productCode, productName, price, and quantityInStock. o calculateInventoryValue(): Calculates and returns the total value of the inventory for the product (price * quantityInStock). o getTotalProducts(): Static method that returns the total number of products recorded. o Getter methods for individual attributes (getProductCode(), getProductName(), getPrice(), getQuantityInStock()) : Provide access to individual attributes of the product.
Output of the given Scenario: