aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes A sample exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "A sample exam question" Watch "A sample exam question" New topic
Author

A sample exam question

Madhusudan Karody
Greenhorn

Joined: Dec 28, 2000
Posts: 2
Could anyone explain what the correct answer the question mentioned below?? I thought the answer was c.
Refer to the Figure http://certify.torolab.ibm.com/figures/test486F9.gif.
Consider the scenario that eStore.com sells small appliances over the Internet. Currently, the store's catalog includes over 50 appliances from 10 different suppliers. A partial class diagram is shown in Figure Sample 1. If there is a new requirement to restock the warehouse automatically as products are sold, how is the new requirement BEST handled?
a)

Add "reorderLevel" and "reorderQuantity" attributes used by a new
deplete() method in the Inventory class. Use these to generate new orders as InventoryProducts are sold.

b)

Add "reorderLevel" and "reorderQuantity" attributes used by a new
deplete() method in the InventoryProduct class. Use these to generate new orders as InventoryProducts are sold.

c)

Add a deliver() method to the Supplier class that uses the
InventoryProduct's amountOnHand attribute to maintain the
InventoryProducts in the warehouse.
d)

Add "reorderLevel" and "reorderQuantity" to InventoryProduct.
Create a Warehouse class that monitors the InventoryProducts'
"amountOnHand", generating an order as levels drop below a
"reorderQuantity".

Thanks
Madhu
Caroline Iux
Ranch Hand

Joined: May 14, 2001
Posts: 103
My answer d.
d allows different InventoryProduct has different reorderLevel and reorderQuantity. Having a Warehouse class will help so that InventoryProduct doesn't have too many responsibilities.
But I am not so sure. B or D? Any help is appreciated!
[This message has been edited by Caroline Iux (edited May 20, 2001).]
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
My answer was also D. For the same reasoning as Caroline's. An InventryProduct should not have the responsibilty of odering itself.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi,
I would lean towards A.
Note that creating a "Warehouse" class and monitoring the "amountOnHand" would lead to a similar relationship as "Inventory" and "InventoryProduct".
The diagram shows that "Inventory contains InventoryProduct".Had there been a "Warehouse" class we would have had "Warehouse contains InventoryProduct" - Thus "Warehouse" class looks redundant to me, since "Inventory" is quite capable to monitor the "InventoryProduct".
Also, since "Inventory" contains "InventoryProduct", the responsibilty to reorder an "InventoryProduct" should be with the "Inventory" rather than the "InventoryProduct".The deplete() method in the "Inventory" class can check the "InventoryProduct.amountInHand" attribute by using "InventoryProduct.inStock()" method.If necessary, it can set the reorder attributes and create the Order instance.
I believe the "reorder level" and "reorder quantity" would probably be decided by the Inventory;they may be implemented as final static variables in Java.For example, it might be if the "amountOnHand" for "InventoryProduct" falls below 100, the Order instance would be created for the InventoryProduct with reorderLevel = A and reorderQuantity=10.The Order instance would be capable to interpret the reorder values.
Please let me know your views on this.
Thanks in advance,
Sandeep
[This message has been edited by Desai Sandeep (edited May 21, 2001).]


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
Lancy Mendonca
Ranch Hand

Joined: Aug 08, 2000
Posts: 54
I have been following this discussion with a lot of interest as I am trying to get to grips with OOAD.
I think Sandeep has raised a valid point,however I fail to understand how the option A will cater to the fact that different inventory products could have different reorder levels and reorder amounts governed by the demand and supply rules. As I understand that option A requires Inventory to maintain reorder levels and reorder quantity.
I feel it depends on the requirements. Option A if all the inventory products are governed by a single reorder level and reorder amt else option D


Sun Certified Java Programmer<BR>Oracle Certified DBA
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi Lancy,
If I am correct, there are different reorder levels (A,B,C and D) and reorder quantities at Inventory Level.All the "InventoryProducts" could be categorized in these levels/quantities.The inventory (or warehouse) decides when to reorder a particular product.The decision to reorder would be influenced by various reasons - one of them being the "InventoryProduct.amountOnHand".Other reasons could be storage space, seasonal change etc.
In that case, the "InventoryProduct.amountOnHand" will only inform the Inventory on quantity "inStock()".Then the Inventory based on other influential factors will decide when to reorder the product.
"Inventory" knows about the environment (is the best judge) of "InventoryProduct".For example,

  1. When (which month?) the demand for the "InventoryProduct" is likely,
  2. Will the "InventoryProduct" endure the seasonal change, or,
  3. Is there enough storage space for the InventoryProduct
  4. ...

  5. Based on above these criteria, "Inventory" would decide when to reorder of "InventoryProduct".Hence the single reorder attributes should be in the "Inventory" class.
    Hope this helps,
    Sandeep

    Hence,I believe these attributes should be of "Inventory" rather than "InventoryProduct".
    Hope this helps,
    Sandeep


Senthil Paramasivam
Greenhorn

Joined: May 02, 2001
Posts: 7
My answer is A. Because InventoryProduct knowns if a product is inStock(). The Supplier is known to the same object
Inventory Object should be get teh task done .
Originally posted by Madhusudan Karody:
Could anyone explain what the correct answer the question mentioned below?? I thought the answer was c.
Refer to the Figure http://certify.torolab.ibm.com/figures/test486F9.gif.
Consider the scenario that eStore.com sells small appliances over the Internet. Currently, the store's catalog includes over 50 appliances from 10 different suppliers. A partial class diagram is shown in Figure Sample 1. If there is a new requirement to restock the warehouse automatically as products are sold, how is the new requirement BEST handled?
a)

Add "reorderLevel" and "reorderQuantity" attributes used by a new
deplete() method in the Inventory class. Use these to generate new orders as InventoryProducts are sold.

b)

Add "reorderLevel" and "reorderQuantity" attributes used by a new
deplete() method in the InventoryProduct class. Use these to generate new orders as InventoryProducts are sold.

c)

Add a deliver() method to the Supplier class that uses the
InventoryProduct's amountOnHand attribute to maintain the
InventoryProducts in the warehouse.
d)

Add "reorderLevel" and "reorderQuantity" to InventoryProduct.
Create a Warehouse class that monitors the InventoryProducts'
"amountOnHand", generating an order as levels drop below a
"reorderQuantity".

Thanks
Madhu

Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Senthil,
I am also with A.But I think you have reasons other than what I have stated.Do you agree/disagree with my reasoning?Could you elaborate on what are your views?
Thanks in advance,
Sandeep
[This message has been edited by Desai Sandeep (edited May 22, 2001).]
Jes Sie
Ranch Hand

Joined: Jul 24, 2001
Posts: 188
Originally posted by Desai Sandeep:
Senthil,
I am also with A.But I think you have reasons other than what I have stated.Do you agree/disagree with my reasoning?Could you elaborate on what are your views?
Thanks in advance,
Sandeep
[This message has been edited by Desai Sandeep (edited May 22, 2001).]


I think your suggestion works too. Perhaps is a lot more flexible than what the original question were asking. It's simply asking for "...to restock the warehouse automatically as products are sold..." Basically, when stocks run low, then get the stock. Not so much on seasonal or running out of space
By the way, you don't agree on D ...is it because it's too hassle to refactor or you reckon it does NOT work?

Thank you.<br /> <br />- Jess Sie<br /> <a href="mailto:jess@see-consulting.com" rel="nofollow">jess@see-consulting.com</a>
Sanjeev Arya
Ranch Hand

Joined: Feb 13, 2001
Posts: 58
I am wondering why hasn't anyone opted for B? Wouldn't that be the easiest solution? I am still not convinced why B is not the answer. I see analogies with:
1. the Observer pattern. InventoryProduct acts as the publisher of the event that an order's stock has gone below reorderLevel and notifies the appropriate class with responsibility to reorder.
2. the data model (even though Fowler and all do not recommend matching class models with data models)! In a RDBMS, wouldn't we have a trigger with the InventoryProduct table to keep track of the stock and reordering logic?
Giving the responsibility to check available to any other class seems too much strain. How often would that class check the available stock of InventoryProduct?
Anyone with a 100% score on the samples?
Thanks
Sanjeev
Salvador Villavieja
Greenhorn

Joined: Aug 03, 2001
Posts: 16
You are right Sanjeev. My answer to this question in one of my mock exam trials was also B and I scored a 100% at that time.
I agree with your reasoning that InventoryProduct is the "publisher of the event".

Judy Herilla
Ranch Hand

Joined: Jan 05, 2001
Posts: 89
Wow!
I got 100% for the section with this question, and I answered C.
I am starting to wonder about the validation of answers on IBM's pretest.

SCPJ2
Salvador Villavieja
Greenhorn

Joined: Aug 03, 2001
Posts: 16
Johanna,
The questions on the IBM sample exams are not ordered according to the test objectives. The distribution of the questions according to the objectives IS correct, but I do not think the questions are ORDERED according to the objectives as they are listed in your exam results.
Salvador
[This message has been edited by Salvador Villavieja (edited August 27, 2001).]
[This message has been edited by Salvador Villavieja (edited August 27, 2001).]
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi,
The correct answer to this question is B.I have scored 100% in the pre-assessment test.Please go through this post for the correct answer and explanations for this question as well as others.
Hope this helps,
Sandeep
SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A sample exam question