Question: SE311 SPRING 2018-2019/12-03-2019 Lab Work 4 IGRADED]: Composite Pattern Goal: Using Composite Pattern through an example. 1. Your task is to implement a composite structure
![SE311 SPRING 2018-2019/12-03-2019 Lab Work 4 IGRADED]: Composite Pattern Goal: Using](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f024bb1a991_07466f024ba72160.jpg)
SE311 SPRING 2018-2019/12-03-2019 Lab Work 4 IGRADED]: Composite Pattern Goal: Using Composite Pattern through an example. 1. Your task is to implement a composite structure similar to the one given in CompositePattern.java under the Week 4's content. 2. This time however, the structure is not about some drawing element. Your composite structure will represent a car. A car has many parts like a chassis, engine, cylinders, pedals or steering wheel. Note that Engine contains other parts in it. The most miniscule part may be a "screw". Each part should have a price attribute weather it is a leaf or non-leaf. 3. [40] You will implement the safety version of the composite pattern. Safety leaf object doing child management operations. Safety is discussed in Week #4's slides from 18-21. property prevents the 4. [10] In main, create a car and add components to it forming a hierarchy. 5. [30] Calculate the total price of the car by writing a totalPrice method. 6. [20] Display the name of the parts in the structure by writing a display method. 7. Test your program. Hint: You can use the same display method in the class composite example. However, you need to modify totalPrice to your needs, if you want to use it from previous examples. Submission Guidelines Reminder Look at the submission guideline documents for details. o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
