CS 146 project

Helen Of Troy, Limited (HELE)
August 8, 2017
Sex Tourism
August 8, 2017
Show all

CS 146 project

This is your sixth CS 146 project. In this project, you will design a form for simulating an automated check-out at a supermarket.

Your task is to create a form and apply the appropriate controls for allowing the user to input UPCs one at a time. The form should place each UPC into an array. The form should have a button for adding UPCs to the array, and another button for calculating a receipt. Last, the form should have a listbox for displaying the receipt.

Where to start

Each item in a supermarket is identified by its Universal Product Code (UPC), which consists of a sequence of 12 digits appearing below a rectangle of bars. The bars have these digits encoded into them so that the UPC can be read by an optical scanner. Let’s refer to the UPC as d1 – d12. The digit d1 identifies the type of product (0 for general groceries, 2 for meat and produce, 3 for drug and heath products, 5 for coupons). The first set of five digits, d2-d6, identifies the manufacturer, and the second set of five digits, d7-d11, identifies the product. The twelfth digit, d12, is a check digit. It is chosen so that:

3 * d1 + d2 + 3 * d3 + d4 + 3 * d5 + d6 + 3 * d7 + d8 + 3 * d9 + d10 + 3 * d11 + d12
is a multiple of 10. This check digit is used in the event that a cashier has to enter the UPC manually and mistypes a digit.
You are to write a program to simulate an automated check-out at a supermarket. A master file, called UPC.txt, should have a record for each item in the supermarket consisting of fields for the UPC, the name of the item, and the price of the item. For instance, the file might contain the following records:

037000004301,Jif Peanut Butter – 22 oz,2.29
070734000034,Ceestial Seasonings Sleepytime Tea,2.59
099482403645,365 Soda Root Beer,.55
You should create a file of at least 10 different items. Make sure that each item has a unique UPC, and that the UPC you create passes the check formula.
The program should allow the cashier to enter UPCs one at a time and should place the UPCs in a single array. Each UPC should be validated with the formula given above as soon as it is entered. The UPC should only be added to the UPC array if it is valid, otherwise you should prompt the user with a message box that the UPC is invalid, and let them enter it again. After all items have been processed, the program should generate a reciept by comparing the UPCs entered by the user to the records stored in the text file UPC.txt. A receipt, similar to the one shown below, should be displayed in the forms listbox:

22-oz Jif Peanut Butter: $2.29
Celestial Seasoning Sleepytime Tea: $2.59
365 Soda Root Beer: $.55
Total: $5.43

Leave a Reply

Your email address will not be published. Required fields are marked *