Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSI 1440 Project 3 Amazon Sales We are going to make our fortunes selling items on Amazon. We have a Product Service of drop ship

image text in transcribed

image text in transcribed

image text in transcribed

CSI 1440 Project 3 "Amazon Sales We are going to make our fortunes selling items on Amazon. We have a Product Service of drop ship items that sends us a text file each day with the "best deals" for tomorrow. With potentially 1000's of entries each day, we have grown weary of reading these text files every day then manually entering our top selections into our Amazon storefront. Fortunately, a discussion with a former classmate at Baylor Homecoming lead to our discovery of the existence of an interface provided by Amazon for stores just like ours. The format is known as JSON (JavaScript Object Notation. Apparently, Amazon has just added the functionality recently, and we are more willing to invest the time to produce files that follow the format required by Amazon Our current selling strategy has been to only sell the top 5 products form the products sent by the Product Service. The top products are selected based off the most profit strategy. We have been calculating the profit of a particular item by taking the difference between the manufacturing cost (our cost) and the predicted sell price which is provided to us by the Product Service text file. In a later class we will learn that we can set up something that allows us to execute the program we just wrote automatically. So, eventually we will be able to post our items of the day without any direct interaction from us. In fact, we could be playing golf when the items of the day are selected and submitted to Amazon. Our boss will never know that we came into work 2 hours late. Shhhh. Our program will need to parse the text file provided by the Product Service. The file is stored in a common file format know as comma delimited files or comma separated values (.csv) with the following format. itemId, decription,manufacturingCost, sellingPrice itemId, decription,manufacturingCost,sellingPrice itemId, decription,manufacturingCost,sellingPrice itemId, decription,manufacturingCost, sellingPrice Our program will store each item from the file into an array of objects. The class we will write for this will be named Itemlnfo. Here is a quick view of the Iteminfo class. Itemlnfo # int itemid # char [40]. description # double: manCost # double. Sel|Price void setltemld(const char ") void setDescription(const char ') void setManCost(const char") void setSellPrice(const char") int getltemld0 const char "getDescriptionO double getManCost() double getSellPrice0 void toAmazonJSON(ostream &) void displayltemlnfo(ostream &) double calcProfit) Here is an example JSON format required by Amazon generated from the following Product Service tems. 54321,Womens S Tank,2.14,19.99 12345,Mens L Graphic Tee,5.35,12.99 firstltem: itemld": 54321, "description": "Womens S Tank", "manPrice: 2.14, "sellPrice": 19.99 "secondltem: "itemld": 12345, "description": "Mens L Graphic Tee "manPrice" 5.35, "sellPrice 12.99 Here is an example of the displaylteminfo output generated from the sample Product Service items described above. This example shows the output generated for the first Itemlnfo in the list. itemld: 54321 description: Womens S Tank manCost:2.14 sellPrice: 12.99 calculatedProfit: 10.85 General Algorithm with Constraints and other Requirements: So the program should open the csv file from our product service with the current list of items. Since we need to learn how to parse files like a computer, you will need to read in the file a character at a time instead of using theoperator. This will help you get into the habit of reading files looking for things, in this case a comma. Features that do automatic conversion during reading from file are off limits in your implementation for this project. Usage of such features will result in 0 on the assignment. You will put what your read from the file into a large character buffer called buffer with a capacity of 500. char buffer(500]; Once your read in a value you will send that to the appropriate function in the Infoltem class (setltemld), setManCost), etc). Since we spent all that time talking about the implementation of strcpy0, strcat), strlen) in class for Chapter 12, the use of the STL String, all the cstring functions, and all cstring to number conversions will also be off limits in this implementation, ie. Implementation of setltemld), setManCost), etc. Usage of such functions will result in 0 on the assignment Since we don't know how many items will be found in the file, we won't know a priori how large to make our array of Infoltem objects. Therefore, we will need to manage an array so that it can grow as needed on the heap. To make this work, you will need to keep separate values for capacity of the array and used to track how much of the array is currently being used. Your initial capacity of this array should start at 2. Your array should "automatically grow" whenever you realize that the used value equals capacity value (array is full), but you need to add one more. You should write a function in your main.cpp file that resizes the array by adding 2 more spots to your array to remedy this issue. Resizing arrays is very important to know how to do safely. Hence the overboard practice of only adding 2 each time here Once the csv file is completely read and all Itemlnfos are happy in the array, you will need to order the array as to have the most profitable items at the top. Sort array by profit Once your appropriate sorting is complete, you will need to make a function that knows how to print the first 5 Iteminfo objects in the array to the screen in required JSON format. In another iteration of this program, we will write the top 5 JSON objects to a file; but not right now. These 5 Iteminfo objects should represent the most profitable items in the feed we received from our product service. Don't forget to return all memory back in an organized way. A memory leak will cost 20 points. You will need to create your own mock version of proj3-productServices.csv for testing your solution locally. I recommend that you create your version of the file using Microsoft Excel or Apple Numbers. You will then need to save the file you created as a .csv file. Here's an example of what the Excel or Numbers file will look like. 54321 Womens S Tank 2.14 19.99 12345 Mens L Graphic Tee Deliverables proj3-ltemlnfo.cpp (Implement each of the function prototypes in proj3-ltemlnfo.hpp) proj3-main.cpp (Solve the problem presented earlier in this document) proj3-testmain.cpp (Fully test each function you wrote as independently as possible) proj3-productServices.csv (One of your mock data files) Provided proj3-Itemlnfo.hpp

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

What are negative messages? (Objective 1)

Answered: 1 week ago