this is the program
A file called Stock.txt contains information regarding the 9 different stock items carried by FUNNY STUFF RETAIL INC. The file is a repeating sequence of three records such that the first record represents an item code number, the second record represents the description of each item and the third record contains the current selling price. Then the sequence repeats. Your program is to simulate the check out register allowing the check out clerk to input item codes to obtain the current selling prices and descriptions. If an incorrect code is entered, the clerk should be notified by an appropriate message on the screen. The clerk will enter the number of items with that description and price and continue to the next item. When all items have been entered the clerk terminates the transaction by entering an item code of 0 (zero). The program will build a sales slip enumerating the item code, description, unit price, quantity purchased, and total extended price. The bill will be subtotaled and an 8% sales tax added for a final total. Amount tendered by the customer and change given will be finally added to the invoice. This invoice should be written out to an output file and the user should be prompted for the output file name. The final total and change should appear on the screen as well.
Your output file should line up all columns with the item code and description left justified and the numeric decimals lined up.
Upload your .cpp file named Lab3.cpp, your pseudocode file named Lab3.txt, and your Stock.txt data file.
The following is the information that is to be put into a file called Stock.txt that will be used as the stock information to be used at the checkout in your program.
Item Code Description Price
1235 Womens Stockings 12.39
2865 Mens Pajamas 17.99
4020 Cotton Dress 23.00
3640 Sweater 20.50
5109 Short Set 56.99
4930 TV Set 88.20
6600 Electric Tooth Brush 94.55
5020 Aluminum Pan 16.79
2336 Pencil Set 4.55
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream inFile;
- int item;
- float price;
- char description;
- inFile.open("sock.txt");
- cout<<"Reading 9 items form stock file.\n\n";
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile>>item;
- inFile>>price;
- inFile>>description;
- cout<<"Item number : "<<item<< " " <<price<< " "<<description <<endl;
- inFile.close ();
- system("pause");
- return 0;
- }