![]() |
|
#1
|
|||
|
|||
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!!! |
|
#2
|
|||
|
|||
|
Quote:
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Quote:
Did you do this: Quote:
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 GIDBlog
Toyota - 2008 August Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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