We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search


+ Link For Assignments, GDBs & Online Quizzes Solution


+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 03
SEMESTER Fall 2017
CS304- Object Oriented Programming

Total Marks: 20

Due Date:  15/01/2018



Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

§  The assignment is submitted after due date.

§  The assignment is submitted via email.

§  The assignment is copied from Internet or from any other student.

§  The submitted assignment does not open or file is corrupt.

§  It is in some format other than .cpp.

Note: You are supposed to submit your assignment in .cpp format. Any other formats like scan images, PDF, zip, doc, rar and bmp etc will not be accepted. All types of plagiarism are strictly prohibited.

For any query about the assignment, contact at CS304@vu.edu.pk


The objective of this assignment is:

o   To give you the idea of practical implementation of Inheritance in CPP.


Problem Statement:

Suppose METRO Cash & Carry Pakistan has given you a task to develop an automatic checkout system in C++. All items are identifiable by means of a merchandise computer code (barcode) and the item name. Groceries are either sold in packs or by weight. Packed items have fixed prices. The price of groceries sold by weight is calculated by multiplying the weight by the current price per kilogram. As a software developer your task is to develop the classes needed to represent the products first and organize them hierarchically according to the UML diagram given on next page.







Bar code

Item Name

















                                       PackedFood                                                                                             FreshFood



Price per piece










Price per rupee

















Figure: UML for METRO Cash & Carry Pakistan





Tasks for you:

1.      Make a base class named Item then define its private and public members. Define a constructor with parameters for both data members (Barcode, Item Name). You should add default values for the parameters to provide a default constructor for the class. In addition to the access methods setCode() and getCode(), you are also required to define the methods scanner() and printer(). These methods will simply output item data on screen or read the data of an item from the keyboard.

2.      Define two derived classes PackedFood and FreshFood. In addition to the Item class data, the PackedFood class should contain the unit price. The FreshFood class should contain a weight and a price per kilogram as data members. You are required to define a constructor with parameters providing default-values for all data members in both classes. Also define the access methods needed for the new data members.

3.      Make the main() function then test the classes in it, that creates two objects each of the types Item, PackedFood and FreshFood. One object of each type should be fully initialized in the object definition. You can use the default constructor to create the other object. The get() and set() methods and the scanner() method should be well written and the printer() method should display the items on screen.

If you have any query feel free to email at cs304@vu.edu.pk




+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

See Your Saved Posts Timeline

Views: 688


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Replies to This Discussion

checkout this link


complete solution of 

CS304 Assignment # 3..step to step,



Latest Activity

+ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! posted a discussion
8 minutes ago
abdul ghafoor replied to + M.Tariq Malik's discussion PSY101 Introduction to Psychology Assignment No 01 Fall 2019 Solution & Discussion in the group PSY101 Introduction to Psychology
13 minutes ago
+ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! replied to ٹمبکٹو's discussion محبّت اور دل - عشق مجازی
15 minutes ago
+ Iuuoɔǝut + posted discussions
27 minutes ago
+ Iuuoɔǝut + replied to ٹمبکٹو's discussion محبّت اور دل - عشق مجازی
30 minutes ago
+ Iuuoɔǝut + replied to + "J ɨ y ą ⋆'s discussion Mohabat
35 minutes ago
+ Iuuoɔǝut + replied to + "J ɨ y ą ⋆'s discussion Hona chahy tha.......
36 minutes ago
+ ! ! ! ! ! MySterIouS replied to ٹمبکٹو's discussion محبّت اور دل - عشق مجازی
1 hour ago
+ "J ɨ y ą ⋆ replied to + M.Tariq Malik's discussion CS402 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 15-11-2019 in the group CS402 Theory of Automata
1 hour ago
+ "J ɨ y ą ⋆ joined + M.Tariq Malik's group
1 hour ago
+ "J ɨ y ą ⋆ posted discussions
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! ! BLaiRe ! !+'s blog post ***NooR E KeyAnAT******HaPpy BiRtH DaY
1 hour ago
+ "J ɨ y ą ⋆ liked +¢αяєℓєѕѕ gιяℓ's blog post Now No One Can Break me.........!
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! ! maho+++'s blog post muhabat k nam pegham
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! ! ! Ayesha +++'s blog post some suggestions of Hazrat Muhammad (PBUH)
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! ! maho+++'s blog post Muhammad Mustafa Aye Bahar Andar Bahar Aaye
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! MySterIouS's blog post + Beginning +
1 hour ago
+ "J ɨ y ą ⋆ liked + ! ! ! ! ! MySterIouS's blog post + Attitude +
1 hour ago
+ "J ɨ y ą ⋆ liked Annu's discussion Please share solution for assig # 01 of wdu 602 fall 2019
1 hour ago
+ "J ɨ y ą ⋆ replied to +¢αяєℓєѕѕ gιяℓ's discussion Mera tu Mohabbat se aitbar.............:-P
1 hour ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service