(a)Understand the concepts cohesion, and how it can be used to decompose problem
ID: 3839736 • Letter: #
Question
(a)Understand the concepts cohesion, and how it can be used to decompose problem definition into separate components(classes).
(b)Understand t and coupling and how it is used to assemble the components (classes)into complete programs.
The establishment called ABC Enterprise requires a Java program to keep a database of the inventory of the products that it sells. Each product is identified by its manufacturer, its name, the quantity, and unit price. Note: a manufacturer is characterized by its company’s name and address In addition to storing the information, the program should be able to make updates to the quantity and/or the price as time goes on. That is, when a sale is made, the quantity of that product must be reduced; similarly, when a product is re-ordered, the quantity of that product must be increased. Also, when there is a change in the price of a product, the price must be changed. The change must be interpreted as a replacement of the value. New products may be added to the inventory at any time; also, a product may be removed from the inventory at any time. Maintain a separate list the products that have been deleted from the database of active products.
Your program must be able to produce three kinds of reports, namely:
(a) Locate a single product and display its name, price and quantity alone.
(b) The inventory report should be structured as follows:
Product PurchaseDate Quantity Price Manufacturer State
Telephone 01/20/2013 10 254.99 Motorola FL
Computer 01/06/2013 15 756.99 CBS NY
: : : : : :
: : : : : :
(c) A list of the deleted products should be structured as follows:.
Product Date Manufacturer
Paper reams 01/20/2013 Morgan Jewelry
: : :
In your design, convince yourself that you need a minimum of four classes, not including the test class – Product, Manufacturer, Address, and Database. You may use the class called GetData.java, Listing 1.6 (in the textbook) , for inputting the data. Use a scrollable panes to display your output.
Explanation / Answer
(a)There are some methodologies that have been used as guidelines towards the good software designs.
Two methodologies are cohesion and coupling.
The concept of cohesion can be applied fo robject oriented software design.
The design requires the programmer to decompose problem definitions into highly cohesive components.
Decompose problems will help to reduce problems and helps in the error correction.
Rarely all systems are purely cohesive.
(b)
Coupling helps to minimize number of interfaces between the modules, minimize the complexity of each interface, and control the type of info flow.
An interface of a module is used to pass information to and from other modules.
In general, modules tightly coupled if they use shared variables or if they exchange control info.
Loose coupling if info held within a unit and interface with other units via parameter lists. Tight coupling if shared global data.
It needs only one field of the record.
assemble the components (classes)into complete programs will helps in good programming and fast response.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.