Google Answers Logo
View Question
 
Q: Array Algorithm or program in C ( No Answer,   3 Comments )
Question  
Subject: Array Algorithm or program in C
Category: Computers > Programming
Asked by: tjiffa-ga
List Price: $20.00
Posted: 23 Nov 2002 11:34 PST
Expires: 26 Nov 2002 07:12 PST
Question ID: 113268
I work for AP systems a new company in NewOrleans, I have a big
project due in a week, but I have no help, I have to write 4 different
programs in 3 diff languages, and make these programs very easy to
explain to people who are just C begginers.  I have 2 very  big
projects to do and I'm afraid I don't have time for the smaller ones,
the truth of the matter is, I'm very strong in Java
but very week in C.Anyway, I need help in writing this program in c,
I've already began the program, and would be most grateful if someone
can complete it for me, Ap systems may even decide to contact you
personally for  future assignments and Big, Big bucks..Please look
through the code I already have and correct any mistakes if you have
to.But I really need the complete program if possible in less than a
week.Please help me out.The question is below the code I've already
written.I will add more money if this program is completed in time.



#define   PLANTNAMELENGTH    40
#define    MAXPLANT                     150
#define PlantFile       plant.data
typedef struct
{
  char bot[PLANTNAMELENGTH];
char common[PLANTNAMELENGTH];
int invLimit;
int inventory;
double wholesalecost;
double retailcost;
int toorder;

} PLANT;

void ReadPlants(plants,&plantcount);
{
file  *plantfptr;
 plantfptr = fopen (plants.data, “r”);
*n=0
while (fscanf (plantfptr, “%s%s%d%d%lf%lf%d”,plants[*n].bot,
plants[*n].common……………) !=Eof);
}


int main(void)
{
PLANT plants [];
Int plantcount;
ReadPlants(plants, &plantcount);
ProcessRetail(plants, plantcount);
Processpurchase(plants,plantcount);

Return0;

}

. This Plant Store keeps data about each houseplant sold, the plants
are identifiable by their botanical names which is needed for
reordering and also by their common names with which the customers are
familiar. The store tries never to stock more than a certain amount
for each plant type. An inventory check is frequently made so that the
store has the current totals for the balance on hand by plant types.

The program must have the ff.
1.inventory data should be maintained as an ASCII (text) file
(plants1.data).
2. A report is needed (retail. report) which will consist of a retail
listing of the inventory. This listing will be ordered by common name.
3.A report is needed (purchase. report) which will contain a listing
of the plants, which need to be reordered.
4.if changes are needed to the inventory data, the transactions will
be applied and a new file (plants2.data) reflecting changes will be
created.

The store determines the actual cost of the plants based on 3
different selling scale markups.

If the wholesale cost of the plant is
Less than or equal to $10.00, selling price is 175% the cost.
Greater than     $10.00 but less than or equal to  $20.00, selling
price is 165% of cost.
 Greater than     $20.00   but less than or equal to     $50.00    
selling price is     155%
  Greater than             $50.00             selling price is 150% of
cost.

The input file, plants. Data contains some of the information you need
to process. The longest botanical plant name will be less than 40
characters in length. The common plant name will also be less than 40
characters in length. There will be no more than 150 plants in the
file.
The info in the data file is formatted as follows: The botanical name
(char), the common name (char), the suggested inventory limit (int),
the number of plants currently in the inventory (int) and the whole
sale plant cost (real).
The suggested inventory limit is the number of plants he has room to
stock of this particular plant and is what he uses to determine how
many plants he has to order for the next shipment. The wholesale cost
of the plant is the actual price the store pays for the plant. You are
to read the plant information into an array of structures and produce
3 separate output files, retail. Report, purchase. report. And
plants2.report.
The first output file retail. Report would consist of a plant name
listing sorted alphabetically by common name. The list would contain
common name and botanical name of the plant, how many of each plant
are currently in stock, what the retail cost of the plant is. If the
number of plants in the inventory is greater than the suggested
inventory limit then the plant would go on sale. The retail cost of
the plant should be lowered by 10%. Finish the retail plant list with
a summary report stating the least expensive plant in the store: the
plant common name, the botanical name in parenthesis and the cost of
the plant. Even if there are 0 of a particular plant in stock at this
time.

The second output file Purchase. Report, will contain the plant
botanical name, how many to order, the wholesale cost for each plant
being ordered and the total cost of these plants. The numbers of
plants to be ordered would be determined by how many plants are
currently in the inventory and what the maximum inventory number is.
If there are 0 plants to order do not put them in this list. If the
inventory number is zero (plants were sold out) then you must increase
the order by 20%. Finish the purchase list with a summary report
stating the total number of plants to order, total cost of the
purchase order, most plants on order and the least number of plants to
order. Do not print the plant if there are no plants to order. There
must be more than 0 plants to order for a plant to be on this list.

Read info from a second input file plants. Update containing update
information and create a new output file plants2.data this second
input file will contain update information to update, delete or add
data to the existing data.

If the first character is
-	U: a plant name (char) and a price (real) will follow. This means to
update the cost of the plant by adding this price to the wholesale
cost of the plant (price could be negative)
-	D: a plant name (char) will follow. This means that this plant is
being removed from the inventory and to delete this item from the
lists.
-	A: this means a new plant is being added to the inventory. The data
following A will be the same format as for the input file,
Plants1.data.You must first test to see if the plant is in the list  
already. If it is in the list, then you must modify it to correspond
to the new data. If it’s not, you must add it to the list.

While performing the plant update, for each update type print an
appropriate message to standard output.

The output file, plants2.data will contain a listing of all plant data
and the update. Once your update if performed, print all of your plant
info to this file plants2.data This output file should resemble the
format of the input file, plants1.data.It would consist of the
botanical name, the common name, the suggested inventory limit, the
number of plants currently in the inventory and the wholesale cost of
the plant. Plant info in this file is to be sorted in ascending order
by common name.
This is a summary of what the program should do.
-USE arrays and structures
read input data
print the reatail plant name, information,and plant summary
calculate retail cost
find the index position lowest priced plant
print the purchase order heading, information and summary
calculate the number of plants to order
miximum and minimum plants to order
purchase order totals
sort the array of structures

Request for Question Clarification by sublime1-ga on 23 Nov 2002 14:41 PST
tjiffa...

If I can point you to a resource which finds a programmer
who can complete your project, will you accept this as an
answer?

Request for Question Clarification by studboy-ga on 23 Nov 2002 20:08 PST
Hi tjiffa-ga

I'll be happy to help you out.
Need some clarification--how do you want me to treat "ties'?
ie, when there are two plants having the same "least expensive
price", do I list them both in the summary?

Yours truly,
studboy-ga

Clarification of Question by tjiffa-ga on 24 Nov 2002 19:58 PST
Hi studboy, thanks for the help,

yes you can list them both  in the summary
remember to keep the program as simple as possible

thanks.

Clarification of Question by tjiffa-ga on 24 Nov 2002 20:49 PST
thanks sublime1. but no
Answer  
There is no answer at this time.

Comments  
Subject: Re: Array Algorithm or program in C
From: vocaro-ga on 24 Nov 2002 21:17 PST
 
You can find such a program here:
http://vocaro.com/plants-program/
Subject: Re: Array Algorithm or program in C
From: tjiffa-ga on 25 Nov 2002 10:09 PST
 
Thanks vacaro, Although by all indications you are a good programmer,
your program, is not exactly what I wanted. I would however contact
you for future projects. I will also highly reccomend you to my
supervisor.
Subject: Re: Array Algorithm or program in C
From: vocaro-ga on 25 Nov 2002 23:26 PST
 
Then what exactly did you want?

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy