Java - Data Structures -


i came across java data structures task. i'm looking confirmation understood correctly , approach right.

the task: product can have many different types of attributes, , can vary between products, e.g. bike can have following attributes: {price, color, size} , product kitchen table: {price, width, depth, height}. product attributes organized in hierarchical group structure, product attribute group can contain 1 or several product attributes and/or product attribute groups. write code needed in java handle above described products , print function prints data in such way clear attributes belong product , attribute group if any.

there image attached notation:
image
figure 1: note order important. in figure above attributes 1, attribute 3 , attributes 2 belong product attributes group.

so approach create abstract product class, , make 2 subclasses(bike, kitchentable) extending product class. correct? or entirely different?

please have @ composite pattern.

the composite pattern describes group of objects treated same way single instance of same type of object. matches task have product attributes have organized in hierarchical groups.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -