Suppose METRO Cash & Carry Pakistan has given you a task to develop an automatic checkout system in C++. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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. For more detail, plz see below...

12th Jan 2018, 11:14 PM
Usman Kokab
Usman Kokab - avatar
4 Answers
0
Tasks for you: 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.Define two derived classes PackedFoodand 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.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.
12th Jan 2018, 11:21 PM
Usman Kokab
Usman Kokab - avatar
0
#include<iostream> using namespace std; class Items { private: int Barcode; string ItemsName; public: Items() { Barcode=0; ItemsName=""; } Items(int b,string name) { Barcode=b; ItemsName=name; } getBarcode() { cout<<"GetBarcode:"<<endl; } setBarcode() { cout<<"setBarcode:"<<endl; } scanner() { cout<<"Scan Barcode"<<endl; } printer() { cout<<"print Barcode:"<<endl; } }; class PakedFood { private: int Price_Per_piece; public: PakedFood() { Price_Per_piece=0; } PakedFood(int p) { Price_Per_piece=p; } setPrice() { cout<<"Set Price "<<endl; } getPrice() { cout<<"Set Price "<<endl; } scanner() { cout<<"Scan Price"<<endl; } printer() { cout<<"Print Price"<<endl; } }; class FreshFood { private: double Weight; double Price_Per_Piece; public: FreshFood() { Weight=0; Price_Per_Piece=0; } FreshFood(double w,double p) { Weight=0; Price_Per_Piece=p; } SetPrice() { cout<<"Set Price "<<endl; } GetPrice() { cout<<"get Price "<<endl; } scanner() { cout<<"scan the Price"<<endl; } printer() { cout<<"Print the Price"<<endl; } }; main() { //we just display two objects Items items; PakedFood pf; FreshFood Freshfod; items.scanner(); items.printer(); return 0; }
11th Aug 2018, 2:58 AM
Muhammad Amir
Muhammad Amir - avatar
0
that is simple explain of requriments but when we read actuall requriemtns of this program then we write down each and every thing about paked and unpaked food
11th Aug 2018, 3:02 AM
Muhammad Amir
Muhammad Amir - avatar