.... How to Find Your Subject Study Group & Join ....   .... Find Your Subject Study Group & Join ....  

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

Study Groups By Subject code Wise (Click Below on your university link & Join Your Subject Group)

[ + VU Study Groups Subject Code Wise ]  [ + COMSATS Virtual Campus Study Groups Subject Code Wise ]

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

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

Total Marks: 20

Due Date:  15/01/2018

 

Instructions:

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

Objective

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.

 

 

 

                                                            

                                                                               Items

Properties:

Bar code

Item Name

 

Methods:

setbarCode()

getbarCode()

...

scanner()

printer()

 

 

 

 

 

 

 

 

 


                                       PackedFood                                                                                             FreshFood

 

Properties:

Price per piece

 

Methods:

getPrice()

setPrice()

...

scanner()

printer()  

Properties:

Weight

Price per rupee

 

Methods:

setWght()

getWght()

...

scanner()

printer()

 

 

 

 

 

 

 

 

 


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

 

GOOD LUCK!

 

Share This With Friends......


How to Find Your Subject Study Group & Join.

Find Your Subject Study Group & Join.

+ Click Here To Join also Our facebook study Group.


This Content Originally Published by a member of VU Students.

+ Prohibited Content On Site + Report a violation + Report an Issue

+ Safety Guidelines for New + Site FAQ & Rules + Safety Matters

+ Important for All Members Take a Look + Online Safety


Views: 617

See Your Saved Posts Timeline

Attachments:

Replies to This Discussion

checkout this link

https://youtu.be/6jleUtzJl7Y

complete solution of 

CS304 Assignment # 3..step to step,

https://youtu.be/4KHmhKG0ctQ

RSS

Forum Categorizes

Job's & Careers (Latest Jobs)

Admissions (Latest Admissons)

Scholarship (Latest Scholarships)

Internship (Latest Internships)

VU Study

Other Universities/Colleges/Schools Help

    ::::::::::: More Categorizes :::::::::::

Member of The Month

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

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