GIDForums  

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

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Oct-2004, 09:07
agentxx04 agentxx04 is offline
New Member
 
Join Date: Sep 2004
Posts: 12
agentxx04 is on a distinguished road

Need some opinion on this please.


Hi. Our professor assigned us to create a program & I just needed some opinions on it. So, any input you can provide would be greatly appreciated.
Thanks! ;-)

ASSIGNMENT:

Write a program which stores coded information about sales for customers. Each customer has a unique number from 1 to 100. The program prompts the user for the customer number, then for the first letter of the customer's last name (use the getche() function in the conio.h library for this), and finally for the amount of the customer's latest purchase. It stores the letter in one array and the purchase amount in another. There should be no more than two arrays in your program.



The user indicates that she has finished entering data by entering a customer number of zero. The program then prompts the user for a customer number, displays the letter and sales amount for that customer, and prompts for another customer number. This display process continues until the user enters zero, which terminates execution of the program. If there is no customer for a given number, the program displays a message to that effect.



To print the sales amount in dollars and cents, use the $%.2f format specifier.



A sample run might look like this:



customer number? 12

first letter of customer’s last name? J

amount of purchase? 57.62



customer number? 92

first letter of customer’s last name? W

amount of last purchase? 103.04



customer number? 0



My greatest concern was that this was not the most efficient way to construct this program. I'm practically a novice when it comes to this, so any advice would be greatly appreciated.

Thanks!!!
Attached Files
File Type: txt program.txt (1.4 KB, 13 views)
  #2  
Old 27-Oct-2004, 09:58
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,693
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by agentxx04
Hi. Our professor assigned us to create a program & I just needed some opinions on it. So, any input you can provide would be greatly appreciated.
Thanks! ;-)

ASSIGNMENT:

Write a program which stores coded information about sales for customers. Each customer has a unique number from 1 to 100. The program prompts the user for the customer number, then for the first letter of the customer's last name (use the getche() function in the conio.h library for this), and finally for the amount of the customer's latest purchase. It stores the letter in one array and the purchase amount in another. There should be no more than two arrays in your program.



The user indicates that she has finished entering data by entering a customer number of zero. The program then prompts the user for a customer number, displays the letter and sales amount for that customer, and prompts for another customer number. This display process continues until the user enters zero, which terminates execution of the program. If there is no customer for a given number, the program displays a message to that effect.



To print the sales amount in dollars and cents, use the $%.2f format specifier.



A sample run might look like this:



customer number? 12

first letter of customer’s last name? J

amount of purchase? 57.62



customer number? 92

first letter of customer’s last name? W

amount of last purchase? 103.04



customer number? 0



My greatest concern was that this was not the most efficient way to construct this program. I'm practically a novice when it comes to this, so any advice would be greatly appreciated.

Thanks!!!


My opinion is that your first concern should probably be to try to satisfy the requirements of the assignment. (That's only my opinion, but you did ask for it.)

As for the assignment: the instructor wants you to learn certain things about using language features. I would never ask someone in a beginning class to create a program with non-standard library functions (getche()), but I'm not in charge of your assignment. My opinion is, therefore, irrelevant.

As for the program itself and its efficiency: my opinion is that you should strive for functionality within the constraints of the assignment (when is it due?). Functionality first; optimization later; refine and beautify it after you are sure that it works. Sometimes I get to the end of a program and see how it could be more elegant by throwing everything away and starting all over again. I rarely have enough time to do this, but I can dream, can't I?

As for your request for responders on this forum: Do you think that your program satisfies the requirements of the assignment? Do you have any questions about its behavior?

Regards,

Dave
  #3  
Old 29-Oct-2004, 10:31
agentxx04 agentxx04 is offline
New Member
 
Join Date: Sep 2004
Posts: 12
agentxx04 is on a distinguished road
I checked to see that my program meets the requirements my professor asked for. It's just that this is the first time I've ever done anything like programming, & it sometimes helps to hear what other people have to say.
I think that this program is efficient, I'm just worried that I may have overlooked at other options (ones that might have used less space) I could have used tho make this program work just as well as this one.
  #4  
Old 29-Oct-2004, 11:05
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,693
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by agentxx04
I checked to see that my program meets the requirements my professor asked for. It's just that this is the first time I've ever done anything like programming, & it sometimes helps to hear what other people have to say.
I think that this program is efficient, I'm just worried that I may have overlooked at other options (ones that might have used less space) I could have used tho make this program work just as well as this one.

Did you do this:

Quote:
The user indicates that she has finished entering data by entering a customer number of zero. The program then prompts the user for a customer number, displays the letter and sales amount for that customer, and prompts for another customer number.

That is, after you have entered all customer data, the program then begins the readback sequence: it prompts for customer number, gets the number from cin, and displays the information for that customer.

So, you are only half done.

If you try to display customer data, you will find that your program didn't actually store the information as the assignment requires.

Regards,

Dave
 
 

Recent GIDBlogToyota - 2008 August Promotion by Nihal

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
web design opinion sho Web Design Forum 16 06-Sep-2004 08:11
Which one is a better deal in your opinion?? CyrixOnFire Computer Hardware Forum 3 10-Aug-2004 09:27
New C++ Compiler: Need an opinion. Neorage_X09 C++ Forum 4 26-Mar-2004 10:53
What's your opinion rosanda Websites Reviewed Forum 6 07-Feb-2004 16:48
Idea for an article Div Learning Journal by J de Silva 3 08-Jun-2003 03:21

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

All times are GMT -6. The time now is 14:31.


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