Question
C++ Program . Please use seekg to read values in separately in a line and store in a 2d array (it is a requirement and
C++ Program .
Please use seekg to read values in separately in a line and store in a 2d array (it is a requirement and not an exception, please DO NOT ANSWER IF YOU CAN ONLY USE GETLINE).
ProductData.csv example:
Item Number,Name,Cost,Qty 12735,Product 001,02.09,121 69703,Product 002,03.64,069 15964,Product 003,10.75,085 24286,Product 004,13.51,197 67671,Product 005,08.42,030 97041,Product 006,14.67,045 60290,Product 007,19.72,030 24600,Product 008,03.02,197 44023,Product 009,11.26,139 46045,Product 010,18.32,018 49814,Product 011,18.95,140 36883,Product 012,05.07,072 (DO NOT READ IN THE 'product' IN NAME)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Objective: Using what you have learned on array search and file I/O you will create a system that allows a user to shop for items, add them to a shopping cart, and process their order.
Details:
- At the start of your program read in the product information from the ProductData.csv file. You must use seekg and seekp to read in the file contents. Do not read in the whole line and separate the data on commas, you will be counted off if you do this.
- The product data must be stored in a multidimensional array (Note: There is exactly 145 items in the product list. You can assume I will not add or remove any items to the product list. So, for this assignment the array size (4 x 145) will be fixed to the total number of products). If you store in single dimensional arrays you will be counted off. Hint: Do not store redundant data.
- After storing the data in your arrays, you must ask the user what products they would like to buy. You will take as input item numbers (Note: The user should be allowed to select up to as many as the 145 items).
- Implement a search function to search your multidimensional array to find the product information You can use any search function you would like. If the item is not found in the array then you need to output and error message. When the item is found you should output the item name and cost.
- Ask the user how many of the item the would like. Check their input against the available qty on hand. Inform the customer if there is not enough available and have them reenter a qty. If there is none available then tell the user we are currently out of stock of the item. After entering a qty that is allowed you must add the item to their shopping cart.
- You must store all the items that the user inputs and keep collecting input from the user until they indicate they are done.
- If the user enters a 0 when asked about entering a product then you know they are done.
- Collect the following user information:
Name
Street Address
City, State Zip code
- You will output to the screen and to a file name invoice.txt a formatted invoice that looks like the following.
Customer Name: John Doe
Customer Address: 123 Sesame Street
Fakeville, TX 12345
Item Number Item Name Qty Unit Cost Total
------------------------------------------------------------------------------------------------------------------------------------------
Item Number 1 Product Name 1 1.99 1.99
.
Item Number X Product Name X 10 1.00 10.00
------------------------------------------------------------------------------------------------------------------------------------------
Total: $11.99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started