Write a C++ program for a smart shopping cart. Item data should be stored in three...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
In this question assume that p and q are atomic formulae. (a) Compare and contrast path formulae and state formulae in temporal logic. [4 marks] (b) Describe and contrast the meanings of F(G p) and...
-
Computer Science 1920 A51 your first assignment! The Astronomy Webstore Learning Objectives: 0 Design classes in the Python 3 programming language 0 Implement accessor (getter) and mutator (setter)...
-
The functions in Exercises 1128 are all one-to-one. For each function, a. Find an equation for f -1 (x), the inverse function. b. Verify that your equation is correct by showing that f( f -1 (x)) = x...
-
Express the kth percentile, Pk, of a normally distributed variable in terms of its mean, , and standard deviation, ?
-
Given that f ( x ) = x 2 4 and g ( x ) = 3 x + 5 , find the value of each of the following, if it exists: ( a ) ( f + g ) ( 5 ) ( b ) ( f + g ) ( 1 ) ( c ) ( f g ) ( 0 ) ( d ) ( f g ) ( 2 ) ( e ) ( f...
-
One end of a pond has a shoreline that resembles a halfbody as shown in Fig. P6.55. A vertical porous pipe is located near the end of the pond so that water can be pumped out. When water is pumped at...
-
Wilkman Semiconductors experienced the following activity in its Photolithography Department during December. Materials are added at the beginning of the photolithography process. Units: Work in...
-
Leadership development is the process which helps expand the capacity of individuals to perform in leadership roles within organizations. Leadership roles are those that facilitate execution of an...
-
New Horizons Co. is a high-tech firm whose owner does not have the required management expertise to run the firm. The owner wants to hire a manager with the required expertise. The continued success...
-
Merlinos Mills is a company that produces flours and grains for grocery stores. It owns mills and distribution centers in the Northwestern and Midwestern United States. The headquarters in Bend,...
-
How many times does the following application print Ready at runtime? A. Zero. B. One. C. Three. D. The code does not compile. E. An exception is thrown at runtime. package parade; import...
-
Which of the following are modules supplied by the JDK? (Choose three.) A. jdk.base B. jdk.basic C. jdk.desktop D. jdk.javadoc E. jdk.jdeps F. jdk.net
-
Given the diagram in question 43 and the correct export statement to share only com. duckling, which of the following should be included in the module-info.java file of com.park to specify that...
-
Suppose the consumer, service locator, service provider, and service provider interface are each in separate modules. Which of the following best describes the following module-info file? A. Consumer...
-
What command is the simplest way to list suggestions for classes in jdk.unsupported? A. jdeps cookie.jar B. jdeps s cookie.jar C. jdeps jdkinternals cookie.jar D. jdeps --jdkinternals cookie.jar E....
-
Critically analyze the item total statistics provided in table 1 and suggest how the cronbachs alpha score of the construct can be improved to reach its desired threshold. Table 1 Item Total...
-
Wholesalers Ltd. deals in the sale of foodstuffs to retailers. Owing to economic depression, the firm intends to relax its credit policy to boost productivity and sales. The firms current credit...
-
The values of an objects attributes are known as its ____________. a. State b. Orientation c. Methods d. Condition
-
All method declarations contain _____________. a. Arguments b. One or more explicitly named access specifiers c. Parentheses d. The keyword static
-
Suppose that a class named Bicycle contains a private nonstatic integer named height, a public nonstatic String named model, and a public static integer named wheels. Which of the following are legal...
-
Individually identify what you consider to be the greatest achievements accomplished by human kind in the last decade. Now share your list with other students in the class and come up with an...
-
What are the differences between a framework, a methodology and a standard?
-
What are the PMI and PRINCE2?
Study smarter with the SolutionInn App