Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 LAB java (Example: ufuk-celikkanLAB3.cpp) o Do NOT send.zip/rar/gz files. No such file likes Lab3.java, HW1.txt, main.java etc. No . I prefer a single java file. Format of the submitted files: No links to external repositories or cloud storage such as onedrive/dropbox/Google Drive project meta files coming from Eclipse/Netbeans/Intellij o .Make the Subject: SE311 2019 LABKLAB-Number (i.e. SE311 2019 LAB4) 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 LAB java (Example: ufuk-celikkanLAB3.cpp) o Do NOT send.zip/rar/gz files. No such file likes Lab3.java, HW1.txt, main.java etc. No . I prefer a single java file. Format of the submitted files: No links to external repositories or cloud storage such as onedrive/dropbox/Google Drive project meta files coming from Eclipse/Netbeans/Intellij o .Make the Subject: SE311 2019 LABKLAB-Number (i.e. SE311 2019 LAB4)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started