![]() |
|
#1
|
|||
|
|||
Question related to Class in C++Hi there I have a problem in writing codes for books class my question is–
The Main Test Program The main function should: Declare an object of type Book Prompt the user for all property values for the book (all values should be stored in local variables declared in the main function). Call the appropriate methods to set the Book's private data members Prompt the user for the number of books to be added to inventory. If the value entered is less than or equal to zero, continue to prompt the user for a value until the value is valid. Prompt the user for the number of books to remove from inventory. If the value entered is less than or equal to zero, continue to prompt the user for a value until the value is valid. If a „false‟ is returned from this function call, display an error message that the number of books exceeds the amount in inventory. Call the appropriate methods to display each of the properties of the book. The class must contain the following private data members: o Title (string) o Author (string) o ISBN (string) o Publication year (integer) o Publisher (string) o Copies in inventory (integer) so far I have done that my header file is here CPP / C++ / C Code:
Now I am confuse in how write the code for adding and removing books from inventory (If the value entered is less than or equal to zero, continue to prompt the user for a value until the value is valid. Prompt the user for the number of books to remove from inventory. If the value entered is less than or equal to zero, continue to prompt the user for a value until the value is valid. If a „false‟ is returned from this function call, display an error message that the number of books exceeds the amount in inventory.) Last edited by admin : 16-Sep-2008 at 19:31.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|||
|
#2
|
|||
|
|||
Re: Question related to Class in c++Quote:
Quote:
Creating a linked list would accomplish the same thing, plus not be constrained by the array size. You may or may not have covered this subject yet. As for removal, you have get & set member functions which are used to initialize each book. When the copies in inventory reaches zero, set the title, author, etc. to empty strings. Last edited by ocicat : 16-Sep-2008 at 14:49.
|
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Returning a Struct to a separate class | usmsci | C++ Forum | 9 | 07-Feb-2007 09:34 |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 20:23 |
| Box Class, need help again :( | TransformedBG | C++ Forum | 7 | 13-Nov-2006 16:11 |
| a tester class and then some. | postage | Java Forum | 1 | 06-May-2006 16:48 |
| Opinion on my code and a c++ class question | FlipNode | C++ Forum | 7 | 07-Feb-2006 09:15 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The