a department-store customer progam

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2007
Posts: 30
Reputation: nkhosinathie is an unknown quantity at this point 
Solved Threads: 0
nkhosinathie nkhosinathie is offline Offline
Light Poster

a department-store customer progam

 
0
  #1
May 11th, 2007
hello everyone.

i'm developing a program from a department-store customerhas exceeded the credit limit on a charge account.for each of the following facts are available.account no,balance of the begining of the month,i total of all items charged by this customer,total of all credit applied to this customer.'m required to instal all the items using while loop.

so what i did is,

int enterInfo=0;
while(enterInfo<5) (x++);
do{
int account,startBalance,endBalance.allowed,credits,charges;

cout<<"enter account number";
cin>>account;

cout<<"enter credits applied to account";
cin>>credits;

cout<<"enter credit card charges";
cin>>charges;

cout<<"enter starting balance";
cin>>startbalance;

cout >>"credit limit?";
cin>>allowed;

so i don't know how to proceed and ene the program please someone help
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,362
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: a department-store customer progam

 
0
  #2
May 11th, 2007
you probably want to create a structure to hold the data for each customer so that the values will not disappear on each iteration of the do-loop. Then you will need an array or a linked list of those structures. After entering the account number search the array or list for the structure that contains that account number. If found then adjust the members of the structure with the values you enter in the do-loop. If the structure is not in the list, fill out a new structure and add it to the array or list.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 30
Reputation: nkhosinathie is an unknown quantity at this point 
Solved Threads: 0
nkhosinathie nkhosinathie is offline Offline
Light Poster

Re: a department-store customer progam

 
0
  #3
May 13th, 2007
so how must i go about doing that i mean the pseudocode of th program
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 103
Reputation: mariocatch is an unknown quantity at this point 
Solved Threads: 17
mariocatch mariocatch is offline Offline
Junior Poster

Re: a department-store customer progam

 
0
  #4
May 13th, 2007
to get you started

  1. struct Customer
  2.  
  3. {<blockquote>int accountNumber;</blockquote><blockquote>double balance;</blockquote><blockquote>int credits;</blockquote><blockquote>int charges;</blockquote><blockquote>Customer(int _accountNumber, double _balance, int _credits, int _charges)</blockquote><blockquote>{<blockquote>accountNumber = _accoutnNumber;</blockquote><blockquote>balance = _balance;</blockquote><blockquote>credits = _credits;</blockquote><blockquote>charges = _charges;</blockquote>}
  4.  
  5. Show()
  6.  
  7. {<blockquote>cout << accountNumber << '\n' << balance << '\n' << credits << '\n' << charges << '\n';</blockquote>}
  8.  
  9. </blockquote>};
  10.  
  11.  
  12. int main()
  13. {
  14. <blockquote>Customer customer1 = new Customer(003593, 45000, 3, 15);</blockquote><blockquote>customer1.Show()</blockquote><blockquote>return 0;</blockquote>}
Last edited by mariocatch; May 13th, 2007 at 3:02 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: a department-store customer progam

 
0
  #5
May 13th, 2007
There are many options available to you. Personally, I would suggest using classes over structs in c++, as you can also define private member functions.

If you are using an array of objects don't forget to clear up after with delete[]. You could also use a vector of objects.

But the most important thing is, if you had to ask what they are, you probably need to read up on them before even attempting to integrate their usage in your current program.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,362
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: a department-store customer progam

 
0
  #6
May 13th, 2007
Originally Posted by iamthwee View Post
There are many options available to you. Personally, I would suggest using classes over structs in c++, as you can also define private member functions. .
In c++ structures are nearly identical to classes, but yes a formal class would be preferable. structures can have private members too, just like classes.
Last edited by Ancient Dragon; May 13th, 2007 at 7:30 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC