Sir Syed CASE Institute of Technology, Islamabad: CS2301L Object Oriented Programming Lab
Sir Syed CASE Institute of Technology, Islamabad: CS2301L Object Oriented Programming Lab
BSCS/BSSE/BSAI
Mid Examinations Spring 2021
Develop an application for an online shopping website which sells different items like shoes,
laptops, shirts, crockery etc. You are required to deal with two items only; Shoes and Laptops.
Shoes and Laptops are two Items that are sold in the Shop. You will maintain appropriate data
members and methods for the items. Following is the basic flow of application:
1. There will be total of five classes; Shop, Item, Shoe, Laptop and Main
2. Abstract Item Class:
a. Item class has data members ID, Price, Discount_Percentage and Brand
b. Pure virtual method int calculateDiscountedPrice() that will calculate the total
price after applying discounts.
3. Laptop Class inherits Item Class:
a. Laptop class has data members: Processor, RAM, HardDisk_Type
b. Implementation of int calculateDiscountedPrice(), use Price &
Discount_Percentage to calculate the discounted price, note that we are not
giving any discount on SSD type HardDisk, so you need to check here if hard
disk is SSD type, then discounted price equals actual price.
4. Shoe Class inherits Item Class:
a. Shoes class has data members: Shoe_type, Color and Size.
b. Implementation of int calculateDiscountedPrice(), use Price &
Discount_Percentage to calculate the discounted price, note that we are giving
30% extra discount on white color shoes since we have too much stock of white
shoes, so total Discount_Percentage is Discount_Percentage + 30%.
5. Shop Class:
a. Shop class has a pointer vector of Item as a data member, vector<Item*> items
b. addItem(Item *item) method that takes input an item and adds it to the vector
of items.
c. getAllItems() function that returns all items in the store
6. Main Class:
a. Main class should display the following menu on the screen:
Press 1 to add Item
Press 2 to get all available Items
8. All required classes should have default constructors and parameterized constructors
with a call to super constructor (if any), display() method with a call to super display()
(if any) and getters & setters.
Marks distribution: