GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Dec-2005, 14:17
cindy cindy is offline
New Member
 
Join Date: Dec 2005
Posts: 1
cindy is on a distinguished road
Question

need help for c++ code ....


[c++]


hi...
i really need help writing this program please i cant do it............
the instructions are....

a mail order house sells five diffrent products whose retail prices are shown in the followingtable:

product# retail price:
178 $2.98
185 $4.59
199 $9.98
208 $4.19
288 $6.87

there are several permanent customers who are ordering these products every month . the program should accept (for every customer) pairs of numbers (product num and quantity sold)and calculate the total retail value of all products sold last month. 8% discount is applied if the retail value exceeds $200.
Program output should include customer's ID (4 digit number) and total retail value for each customer . in additon the program should calculate and displayhte number of customers , total sales and average retail value.
the program should also allow user to run multiple sets of data and to terminate the program when there is no data anymore.


thank u
your help will be appriciated a lot......
  #2  
Old 05-Dec-2005, 17:35
Sokar Sokar is offline
Member
 
Join Date: May 2005
Posts: 243
Sokar has a spectacular aura aboutSokar has a spectacular aura about

Re: need help for c++ code ....


I would first work out how to write the code so that you can only input one item and forget the loop for now.
You might try two arrays one for,
CPP / C++ / C Code:
int product[] = { 178, ...};
and one for,
CPP / C++ / C Code:
double retail_price[] = {2.98,...};
Now you will just need to get the product number as input and find what the index is in the product array and use that index to get the price.
Once you get that to work then move onto other parts of the program. Post back with ant questions.
Last edited by Sokar : 05-Dec-2005 at 18:24.
  #3  
Old 05-Dec-2005, 18:12
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 923
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: need help for c++ code ....


Hi cindy,

Welcome to GID Forums.

Just a little correction on Sokar's description:
The array should be declared like this:
CPP / C++ / C Code:
int product[] = { 178, ...};
and
CPP / C++ / C Code:
double retail_price[] = {2.98,...};
You may also want to create two more arrays, one for customer ID, and another for the customer's retail value.

I hope you know arrays.

You should have one loop to get the values from the user, say a do while loop.
How much in C++ have you studied? Do you know dynamic memory location, or vectors?

Regards,
Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #4  
Old 05-Dec-2005, 18:23
Sokar Sokar is offline
Member
 
Join Date: May 2005
Posts: 243
Sokar has a spectacular aura aboutSokar has a spectacular aura about

Re: need help for c++ code ....


Quote:
Originally Posted by Paramesh
Just a little correction on Sokar's description:
The array should be declared like this:
opps
Thank you for the correction on that blunder.
 
 

Recent GIDBlogNARMY by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Formatting C / C++ code WaltP C Programming Language 1 06-Jan-2008 23:59
Image processing:Stentiford and Holt Thinning Source code in C or C++ ladyscarlet99 C++ Forum 1 09-Sep-2005 03:29
Guidelines for posting requests for help - UPDATED! WaltP C++ Forum 0 21-Apr-2005 02:44
Problem with int mixed with char,... leitz C++ Forum 17 07-Dec-2004 20:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:08.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.