Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

As stated today, we are going to make our fortunes selling items on Amazon. We have a Product Service of drop ship items that sends

As stated today, 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. We have grown weary of reading these text files every days numbering in the 100s of entries each day, and then manually entering them in our Amazon store online. However, Amazon will allow us to upload a binary file to designate our choices. WOOHOO!!!

We have decided as a selling strategy to only sell the top 4 products from the list of products sent by the Product Service.

So to solve this problem, we are going to need 2 programs.

The first program will just be to create the initial array and make the initial binary file for upload to amazon.

The second program will read our current binary file into our array of products to sell and then read the text file from our Product service. It will then determine the best products to sell. The 4 items in which items the selling price - manufacturing price are greatest.

The text files from our service and the initial file of products we want to sell will have the following format:

itemid\t description\t manufacturingCost\t sellingPrice

itemid\t description\t manufacturingCost\t sellingPrice

itemid\t description\t manufacturingCost\t sellingPrice

...

itemid\t description\t manufacturingCost\t sellingPrice

end of file

For both programs we will be using the same struct, so we will put our struct declaration in a separate file. Upload-site Filename: p6-Struct.h.

typedef struct {

int itemid;

char description[40];

double manCost;

double sellPrice;

} ItemInfo;

For program 1 Upload-site Filename: p6-First.c

you will need to make an array of ItemInfo(s). For now we will make size of array of items we are going to sell 4, later we could revise to larger...so make a const for that will ensure that its easily changed.

You will need to read in file of initial four items (you create this) and put them in your array of items to sell. Upload-site Filename: p6-initial.txt

Once the 4 items are in the array of structs, write them out to our binary file for Amazon. Upload-site Filename: p6-Amazon.bin

be sure to close all files.

For program 2 Upload-site Filename: p6-findSaleItems.c

you will need to make an array of ItemInfo(s) for the items in the binary file created above in program 1. Upload-site Filename: p6-Amazon.bin . Again, for now we will make size of array of items we are going to sell 4, later we could revise to larger...so make a const for that will ensure that its easily changed.

You will need to make an array of ItemInfo(s) that will come from the Product Service. There can be up to 1000 entries in this file, so you will need to make an array that is 1000, but again can be configured later if necessary. Upload-site Filename: p6-PSitems.txt

Once the 1000 items are in the second array of structs, you will need to loop through the new items array to see if any items will replace the items already in the array of items we are going to sell. If better than replace.

Once done, print out 4 items to sell to screen and then overwrite items to binary file for Amazon. Upload-site Filename: p6-Amazon.bin

finally be sure to close all files.

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions