Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3: Self-checkout machines provide a mechanism for customers to pay for purchases from a shop without direct input to the process by the shop's

 

Q3: Self-checkout machines provide a mechanism for customers to pay for purchases from a shop without direct input to the process by the shop's staff. Create a class called Checkout for performing checkout service in a shopping mall. Use char variable to represent the item, unsigned long to represent the barcode, float variables to represent the price and the weight as private data of the class. Provide a constructor that enables an object of this class to be initialized when it's declared Provide public methods that perform each of the following tasks: a. The operator & for printing the item, barcode, price and weight. b. A friend function called get price. This function would return the price when you provide it with an object and a barcode. This function should return -1 if the object's barcode doesn't match the input barcode. c. A friend function called get_price. This function would return the price when you provide it with an object and an item name. This function should return -1 if the object's item-name doesn't match the input item's name. Define the following array of objects as a database in your main. checkout a[3]={checkout("Sugar", 12345,1000,1), checkout("Rice", 13450,2000,2) checkout("Oil",13456,3000,1) }; Use get price function to return the price of the barcode (13450) and the item "Sugar" then print the results. [10 marks]

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Organic Chemistry

Authors: Graham Solomons, Craig Fryhle, Scott Snyder

11th edition

1118133579, 978-1118133576

More Books

Students also viewed these Chemistry questions

Question

Provide a mechanism for the following reaction. HCI CI

Answered: 1 week ago

Question

What is the outlook for fast-casual restaurants? LO1

Answered: 1 week ago