Question
To compute a grocery bill, a checkout stand typically has a scanner to identify product codes of items. This code is used to get the
To compute a grocery bill, a checkout stand typically has a scanner to identify product codes of items. This code is used to get the price of the item from the stores price list, along with the item name and whether it is taxable. This information is then used to compute the price of the item and the total of the bill (see figure below). In this project, you will write C++ code to represent the workings of such a cash register.
Objective
You are given partial implementations of three classes. PriceList is a class to hold information of all items in the grocery store. There could be up to 1,000,000 items. The information of each item is its price, barcode, item name, and whether it is taxable; these are kept together in Class PriceListItem. The items in PriceList are loaded all together from a text file, or inserted one at a time. The complete grocery bill is computed in Class GroceryBill. To do so, it is given (a const pointer to) a previously created PriceList to get the prices, and the tax rate percentage for taxable items when constructed. It is then given barcodes of items and their quantity. The barcodes can be given one at a time, or they can be collected together in a text file.
You are to complete the implementations of these classes, adding public/private member variables and functions as needed. You should not use any of the C++ Standard Library containers (such as std::array, std::vector, std::list) for this project. Your code is tested in the provided main.cpp. Initially, the given code does not even compile. As you complete the code, it will pass the tests in the main.
Source Code Files:
You are given skeleton code with many blank spaces. Your assignment is to fill in the missing parts so that the code is complete and works properly.
The included C++ code has multiple files:
-PriceListItem.h and PriceListItem.cpp: This is to be completed, with public/private member variables and functions as needed, so that it can be used in other classes.
-PriceList.h and PriceList.cpp: This is to be completed, with public/private member variables and functions as needed.
This class contains a method to read item information from a text file. This method is already implemented.
-GroceryBill.h and GroceryBill.cpp: This is to be completed, with public/private member variables and functions as needed.
-main.cpp: Code that brings everything together into one application. The main function also tests the output of your functions. This is already complete and you should not change this code
Source Files: https://www.mediafire.com/file/96vt5cubhk0c5kt/sourcefiles.zip
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started