Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program Project Description A small market maintains an inventory of exactly 20 items. You will read these items from a file. Each item named

C++ Program

Project Description

A small market maintains an inventory of exactly 20 items. You will read these items from a file. Each item named will have an associated cost and a character code to indicate whether or not it is taxable. You will place your online order. A file will contain your "printed" receipt with the total amount of your order.

Project Specifications

Input for this project has two sources. The inventory of exactly 20 items (with cost and tax code for each) is read from an input file. The user must enter: the names of the input and output files, and the items to purchase (by the number code associated with each item.) Output also has two sources. The command line shows the names of the inventory items, the echo of the chosen item with its price and "taxable" if appropriate. The amount of the tax and the total amount due will appear on the command line screen when the user is finished. The tax rate is 7% (use .07 in your code.) The "printed" receipt will be on the output file. All the non-taxable items should be listed first followed by the taxable items, then the total amount of the tax, and last the total amount due.

Processing Requirements Create the functions for the following:

1. Read the inventory: Prompt for and get the input file name, open the file, read the items from the file, and store them into the three parallel arrays. The three arrays will be passed as parameters. (NO GLOBAL VARIABLES) Assume that the file contains exactly 20 lines of input and is constructed correctly. Return 0 to the calling function if the file opens, -1 if the file is not found. If the file is not found, do NOT process the grocery order or attempt to write to the output file. 2. Process the grocery order: Assume the user will choose no more than 20 non-taxable items and 20 taxable items. The user enters the code for the item. Validate the item code. Determine from the tax code of N or T whether to place the item in the non-taxable array(s) or the taxable array(s). Output the amount of the tax and the total amount due for the order. All items used in this function should be passed as parameters. Your last line from this function should be Thank you for your online order. 3. Calculate and return the total of array elements. The array and the number of elements in the array should be parameters. This function should be called at least two times. 4. Validate the input item code using a Boolean function (return true or false) from this function. 5. Write the "printed receipt" to the output file: Prompt for and get the output file name, open the file, and output the items, non-taxable items first with the cost of each, then the taxable items with the cost of each and taxable in the same line. Print the total amount of the tax, and the total amount due for the order. Your last line should be "Thank you for your on-line order." Your parameters should include all items needed for your printed receipt. Your command line output should be in the format shown below:

image text in transcribed

Minimart.txt

gallon-milk 3.29 N ice-5lbs 0.99 N barsoap-6pk 4.39 T shampoo 4.94 T lotion 4.99 T cereal 2.30 N bagels-6pk 1.99 N muffins-2pk 2.10 N muffins-3pk 3.49 N eggs-dozen 0.89 N bread 0.99 N butter-1lb 2.35 N cookingOil 3.29 N sugar-1lb 1.39 N detergent 4.99 T bleach 0.99 T orangeJuice 1.99 N coffee-6oz 5.19 N sugar-3lb 2.09 N teabags50 2.99 N motoroil 1.39 T iceshovel 12.99 T potato-5lb 2.49 N cola-12pk 3.99 N phonecard25 5.00 T phonecard60 10.00 T 

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

Step: 3

blur-text-image

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

=+c. All colleges require morning exercise in appropriate attire.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago