Question: Create the text data file (10 pts): The input for this program has two sources: the inventory information is input from a text file, and
Create the text data file (10 pts): The input for this program has two sources: the inventory information is input from a text file, and the customer transactions are input from the keyboard. The information about each product carried by the store is listed on a single line in the inventory file Input.txt", in the following format: 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 bread 0.99 N 40000 Organic Eggs 2.99 N 40020 Organic Chicken Broth 3.99 N where is a five-digit positive (nonzero) integer, is a string of at most 12 characters with embedded blanks, is a real number, and is a character ('T' if the product is taxable; 'N' if it is not taxable). Create a text file with the above data. Processing: The program first reads in all of the inventory information from file "Input.txt" Save all records into the data structure array which is declared with the pointer variable. (10 pts) Your main function keeps working until the user enters the numeric value 0. The program prompts the user to begin inputting the order for the customer in the following format: Where is as described above, and is an integer in the range 1 to 100, indicating the quantity of this product desired. A zero input for indicates the end of the customer's order. (10 pts) Check the entered product is in the data structure. If exists, the program can process the transaction. Otherwise, write an error message on both the screen and receipt, ignore that product number, and continue with the next product item. You need to define the following functions and you need to decide the parameter list. (20 pts) void readDataFromFile(); //read data from the text file and then save them into the data structure. (10 pts) void printReceit(); // Receipt is printed to the output file. (10 pts) void displayResult(); // display result on to screen. (20 pts) bool validateItem(); // check if the enter item is in the inventory or not. The 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. (10 pts) 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.) The program outputs should be written to a text file called "Output.txt" as well as displaying to the screen. Sample Results: From File "Input.txt": 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 bread 0.99 N 40000 Organic Eggs 2.99 N 40020 Organic Chicken Broth 3.99 N From keyboard: 11110 2 40012 3 20115 1 0 To "Output.txt" file and to screen: 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
