Question: Question 4 Design Patterns (a) In a manufacturing plant, a product (such as a car or a computer) is assembled from other parts. For example,

Question 4 Design Patterns (a) In a manufacturing plant, a product (such as a car or a computer) is assembled from other parts. For example, a car might be assembled from a chassis, an engine and a body: in turn, the chassis might be assembled from a frame and some wheels, etc. Use the Composite pattern to write Java classes for Assembly and Item with a method getPrice for calculating the total price of any given part. Each Item has a given price (assume that price is a parameter to the class constructor for Item), and the price of an Assembly is the total price of all parts in the assembly Draw a UML class diagram for your program that demonstrates that your design conforms to the Composite pattern as defined in this course
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
