Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program for a smart shopping cart. Item data should be stored in three parallel ID arrays. The first contains the selected

 

Write a C++ program for a smart shopping cart. Item data should be stored in three parallel ID arrays. The first contains the selected item barcode, second contains the total number of pieces (quantity) picked of the selected item and the third one contains the price for each item. i) Write a function, called read that reads the carts' item details. ii) Create the function TotalPrice that would calculate the total price of each item in the cart. iii) Create the function printItems that would print all the items stored in the parallel arrays in a tabular format. iv) Create the function findFavouriteltem that would return the barcode of the item bought in largest quantity. v) vi) Create the function findItemPriceByBarcode that would return the final price of the specified barcode item. If barcode does not exist, the function should return -1. In the main function, read the values of the parallel arrays using read, print the arrays in a tabular format using print.Items, and print the item bought in largest quantity using findFavouriteitem. vii) Also in the main, ask the user to enter a barcode, search for it using findItemPriceByBarcode, and if the item is found, display the total number of sold items; otherwise, display an error message. The output of your program might look similar to the example below (user input indicated in bold). Barcode Number of Pieces Price Total 24 40 20 10212 10213 10215 2 5 1 12 8 20 The barcode of your favourite item is: 10213 Enter the barcode for the total number of sales of the item> 10212 The total price of selected item 10212 is $24.

Step by Step Solution

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

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions

Question

What is a supply chain?

Answered: 1 week ago