Representing a product that small company sells.

Posted 20 November 2012 - 02:51 AM

Greetings everyone .
I need to make program according to this excersice. I have wrote some code but still i do not understand what exactly suppose to do. Please guys help me.
Write a class, Product, that could be used for representing a product that a small company
sells. It should be possible to store the following information about each product. An
identifier, i.e. a product number (use an integer), a product name (use a string), price (float
should be used), order point (integer), units in store (integer) and product description (string).
The class should have the following methods:
• A constructor
• A method that returns the units of items in store
• A method for deliverance to the store (increases the units of this product)
• A method for withdrawal from the store (decreases the units of this product)
Please note that if one of the methods changes the stored items below the order point a
message should be printed. It should also be impossible to have a negative amount of items.

Replies To: Representing a product that small company sells.

Re: Representing a product that small company sells.

Posted 20 November 2012 - 03:33 AM

Improvements to make:

Post your code in code tags.
Use variable types as required - not all Strings
Constructors don't have return types
You may want multiple constructors (but start with one)
Add the required method to return units of items
Add the required method for adding units of existing items to stock
Add the required method for reducing units of existing items to stock

Ensure the method that reduces:
Checks the order point and prints a message to order more
Won't decrease the number of units below zero.

Re: Representing a product that small company sells.

Posted 20 November 2012 - 04:10 AM

At first you don't understand exactly what you're supposed to do, and now you don't understand how to create methods. Volunteer time here is portioned to those who ask clear, understandable questions that have bounded answers. Continued vagueness or broad "what is the meaning of life" questions from you will be ignored. Please be specific in what you need help with.