Q3: Self-checkout machines provide a mechanism for customers to pay for purchases from a shop...
50.1K
Verified Solution
Link Copied!
Question
Accounting
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 cach 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) 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 cach 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)
Answer & Explanation
Solved by verified expert
Get Answers to Unlimited Questions
Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!
Membership Benefits:
Unlimited Question Access with detailed Answers
Zin AI - 3 Million Words
10 Dall-E 3 Images
20 Plot Generations
Conversation with Dialogue Memory
No Ads, Ever!
Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!