satrah
05-24-2006, 12:34 PM
Heres An Assesment I'm Doing, I really Need help On The Item & stockTake Objects, If Anyone Could Help that Would be Wonderful, Cheers; SATRAH
The ITEM Object
Overview of the ‘item’ object
? Create the ‘item’ object using only stubs and output statements.
Use meaningful variables and use plenty of internal comments.
‘Item’ objects represent/hold information about different things sold by a shop. Each object must contain attributes and methods as detailed:
Attributes:
? The name of the item; a string (eg: MILK)
? The quantity currently in stock; an integer (eg: 4)
? The current price of the item; a double (eg: 8.90)
NOTE: When a new ‘item’ object is created it accepts three parameters to initially set the above attributes.
Methods:
? A Reader method ("toString") which returns a string containing the details of the current state of an item. These details should include the name, quantity, price & value.
? A Writer method for the name
? A Writer method for the price. This should only change the price attribute if the new price is a positive (can't have a negative number).
? A Writer method for the quantity. This should only change the quantity attribute if the new quantity is a positive (can't have a negative items).
NOTE: Only these attributes and methods are required, although others such as size etc could be added.
Save the finished file as StockTake.js (do not include test data!)
The STOCKTAKE Object
Overview of the ‘item’ object
? Create the ‘item’ object using only stubs and output statements.
Use meaningful variables and use plenty of internal comments.
The ‘stockTake’ object must contain attributes and methods detailed:
Attributes:
? An array to hold ‘item’ objects – called ‘groceries’
? An integer to keep track of how many ‘item’ objects are actually stored in the array at any time called ‘numStored’.
NOTE: When a new ‘stockTake’ object is created it accepts as a parameter a number to indicate how big the groceries array will be. If no parameter is received it will create a groceries array with 50 elements.
Methods:
? A method called ‘addItem’ which accepts as a parameter a reference to an ‘item’ object. This method will store the reference to this ‘item’ object into the next available cell in the array. The attribute, which keeps track of the number of stored ‘items’, should then be incremented.
? A method called ‘findItem’ which accepts as a parameter a string representing the name of an ‘item’. This method will search through the array of ‘items’ and if found it will return the items details via the ‘toString’ method. If no matching item is found the Boolean value false is returned.
? A method called ‘stockValue’ which returns the current value of the entire collection of ‘items’. This value is the sum of all the values of the individual ‘items’ in the array.
? A method called ‘getNeededItems’ which traverses the array of ‘items’ and collects the names (ONLY) of any ‘item’, which has a quantity that is less than 10. These names (strings) are copied into another array which is returned to the calling code.
NOTE: The collection does not have to be sorted in any way and deleting items is not required.
The USER INTERFACE
The user interface is web based and should create a single ‘stockTake’ object when the page is loaded.
It is suggested that you also code the creation of three items and add them to the newly created ‘stockTake’ object each time the page is loaded. This will allow for easier testing as your collection will already have 3 ‘items’ every time you load the page.
The user interface must provide a simple button menu to the user and use a text area for displaying the results of each operation.
to help with scripting the buttons will be called:
? View All Stock
? Add An Item
? Find An Item
? Needed Items
? Value Of All items
? RESET
--------------
if anyone could help out with this it would be great! CHEERS!:thumbsup:
The ITEM Object
Overview of the ‘item’ object
? Create the ‘item’ object using only stubs and output statements.
Use meaningful variables and use plenty of internal comments.
‘Item’ objects represent/hold information about different things sold by a shop. Each object must contain attributes and methods as detailed:
Attributes:
? The name of the item; a string (eg: MILK)
? The quantity currently in stock; an integer (eg: 4)
? The current price of the item; a double (eg: 8.90)
NOTE: When a new ‘item’ object is created it accepts three parameters to initially set the above attributes.
Methods:
? A Reader method ("toString") which returns a string containing the details of the current state of an item. These details should include the name, quantity, price & value.
? A Writer method for the name
? A Writer method for the price. This should only change the price attribute if the new price is a positive (can't have a negative number).
? A Writer method for the quantity. This should only change the quantity attribute if the new quantity is a positive (can't have a negative items).
NOTE: Only these attributes and methods are required, although others such as size etc could be added.
Save the finished file as StockTake.js (do not include test data!)
The STOCKTAKE Object
Overview of the ‘item’ object
? Create the ‘item’ object using only stubs and output statements.
Use meaningful variables and use plenty of internal comments.
The ‘stockTake’ object must contain attributes and methods detailed:
Attributes:
? An array to hold ‘item’ objects – called ‘groceries’
? An integer to keep track of how many ‘item’ objects are actually stored in the array at any time called ‘numStored’.
NOTE: When a new ‘stockTake’ object is created it accepts as a parameter a number to indicate how big the groceries array will be. If no parameter is received it will create a groceries array with 50 elements.
Methods:
? A method called ‘addItem’ which accepts as a parameter a reference to an ‘item’ object. This method will store the reference to this ‘item’ object into the next available cell in the array. The attribute, which keeps track of the number of stored ‘items’, should then be incremented.
? A method called ‘findItem’ which accepts as a parameter a string representing the name of an ‘item’. This method will search through the array of ‘items’ and if found it will return the items details via the ‘toString’ method. If no matching item is found the Boolean value false is returned.
? A method called ‘stockValue’ which returns the current value of the entire collection of ‘items’. This value is the sum of all the values of the individual ‘items’ in the array.
? A method called ‘getNeededItems’ which traverses the array of ‘items’ and collects the names (ONLY) of any ‘item’, which has a quantity that is less than 10. These names (strings) are copied into another array which is returned to the calling code.
NOTE: The collection does not have to be sorted in any way and deleting items is not required.
The USER INTERFACE
The user interface is web based and should create a single ‘stockTake’ object when the page is loaded.
It is suggested that you also code the creation of three items and add them to the newly created ‘stockTake’ object each time the page is loaded. This will allow for easier testing as your collection will already have 3 ‘items’ every time you load the page.
The user interface must provide a simple button menu to the user and use a text area for displaying the results of each operation.
to help with scripting the buttons will be called:
? View All Stock
? Add An Item
? Find An Item
? Needed Items
? Value Of All items
? RESET
--------------
if anyone could help out with this it would be great! CHEERS!:thumbsup: