Simulate the operation of a grocery store checkout system

Assignment Help C/C++ Programming
Reference no: EM132211745

Assignment

You will write, run, and test a C++ program to simulate the operation of a grocery store checkout system. Your program should first build a data structure to contain information on all the products available in the store. Then the program should print the cash register receipt for each customer.

Input
The input for this program has two sources: the inventory information is an input from a text file, and the customer transactions are inputs from the keyboard.

1. The information about each product carried by the store is listed on a single line in the inventory file "Invent.dat", in the following format:
<product number><description><price><tax>

where <product number> is a five-digit positive (nonzero) integer, <description> is a string of at most 12 characters with no embedded blanks, <price> is a real number, and <tax> is a character ('T' if the product is taxable; 'N' if it is not taxable). The data in the inventory file is ordered from the smallest to the largest product number.

2. Customer transactions are input from the keyboard, in the following format:
<product number><times>
where,<product number> is as described above, and <times> is an integer in the range 1 to 100, indicating the quantity of this product desired. A zero input for <product number> indicates the end of the customer's order. (The store will soon be using a scanner to input the product number, but for now it is typed in by the cashier.)

Output

The program outputs should be written to a text file called "Receipts.out."

1. The inventory information is echo-printed to the output file.

2. The cash register receipt for each customer is written to the output file. The receipts should be nicely formatted, with the product description (not the product number), number of items, item price, and total price for each product printed on a single line. At the end of each customer's order, the subtotal for all items, amount of tax on taxable items, and total bill should be printed, clearly labeled. (The tax rate is 7.5% for taxable items.)

Processing

1. The program first reads in all of the inventory information from file "Invent.in." echo-printing the information to the output file.

2. The program then prompts the cashier to begin inputting the order for the first customer.

3. This customer's order is processed, and the receipt is printed to the output file.

4. After each customer's order is processed, the program asks the cashier if another customer is to be processed. If the answer is 'Y', the program sets up to process the next customer; if the answer is 'N', the program terminates with a friendly message.

Error Checking
The following input errors are possible and should be handled by an exception class:

1. Duplicate <product number> in inventory file. Write an error message to the output file and skip the second entry.

2. <Product number> not in inventory file. Write an error message on the receipt, ignore that product number, and continue with the next item.

3. <Times> not in the specified range. Write an error message to the output file, ignore that line, and continue with the next item.
Example
From File "Invent.in":
11012 gallon-milk 1.99 N
11014 butter 2.59 N
11110 pie-shells 0.99 N
20115 laundry-soap 3.60 T
30005 homestyle-br 0.99 N

From keyboard (one customer):
11110 2
40012 3
20115 1
0

To "Receipts.out" file:
------------------------------------------------------
SEP 10, 1998 6:00 pm (* date and time optional *)
Customer 1
pie-shells 2 @ 0.99 1.98
*** item 40012 not in inventory ***
laundry-soap 1 @ 3.60 3.60 TX
Subtotal 5.58
Tax 0.27

Total 5.85

Data Structures

The inventory information can be stored in an array of product records. Assume that the maximum number of products is 50, for purposes of writing this program. You should specify this data structure as an ADT, as described in the chapter and define and implement a set of operations to encapsulate it. The ADT should be tested using a test driver.
Deliverables
• Your design (either object-oriented or top-down)
• A listing of the ADT
• A listing of the test driver for the ADT
• A listing of the test plan as input for the driver
• A listing of the output from the test driver
• A listing of your program
• A listing of your test plan as input to the program
• A listing of the output file

Verified Expert

The task of the assignment involves writing a c++ program for the grocery store application.The assignment involves reading data from the input file and writing the output to the output file.The input file contains list of products.Each product information is stored in the separate line.The product information are stored in the class file.The product purchased by the user is specified via keyboard.The receipt generated is output to the output file named Receipts out.

Reference no: EM132211745

Questions Cloud

Improvement in the value of objective function per unit : The improvement in the value of the objective function per unit increase in a right-hand side is the
Find the modified duration : Question - Given the following cash flows and an interest rate of 5%: Find the modified duration
Find velocity of ball at any time : A ball is thrown vertically upward with a velocity of 2450 / sec. cm Neglecting air resistance, find: velocity of ball at any time t.
Should college athletes be compensated beyond scholarships : Should College Athletes Be Compensated Beyond Scholarships ?
Simulate the operation of a grocery store checkout system : Implement a set of operations to encapsulate it. The ADT should be tested using a test driver - The program then prompts the cashier to begin inputting
Determine the number of shares : Using Black Sholes option pricing model, calculate the delta of the call position and determine the number of shares of the underlying stock
How would you select a qualified person for a position : How would you select a "qualified person" for a position? What makes a successful leader in healthcare? In the competitive healthcare environment.
Laws put on the books to help keep us safe : Due to all the turmoil that is going on both within the US as well as abroad should we have more laws put on the books to help keep us "safe"? Elaborate.
Explain the possible thinking behind each proposal : Explain the possible thinking behind each proposal and why you would favour one over the other based on your evaluation of their strengths and weaknesses.

Reviews

len2211745

1/9/2019 9:10:42 PM

Deliverables Your design (either object-oriented or top-down) A listing of the ADT A listing of the test driver for the ADT A listing of the test plan as input for the driver A listing of the output from the test driver A listing of your program A listing of your test plan as input to the program A listing of the output file

len2211745

1/9/2019 9:09:56 PM

write, run, and test a C++ program to simulate the operation of a grocery store checkout system. Your program should first build a data structure to contain information on all the products available in the store. Then the program should print the cash register receipt for each customer. The rest of instructions is attached.

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd