Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Homework (Factory Method) Write a Java code using Factory Method design pattern to solve the following relation of Products, Factory, Distributor and Clients

Homework (Factory Method) Write a Java code using Factory Method design pattern to solve the following relation of Products, Factory, Distributor and Clients

Computer Science

Homework (Factory Method)

Write a Java code using Factory Method design pattern to solve the following relation of Products, Factory, Distributor and Clients.

- The distributor sells product including: Laptop, PC monitor and TV.

- Each product has its own descriptions detail: getDetail()

Ex: when call getDetail for laptop will output following

Brand - Dell

Manufacturing date : 01/01/2021

- The distributor contain function: orderProduct(String productName)

productName = name to products like “laptop”, "PC monitor” or “TV”

- The factory contain a function: createProduct(String productName)

productName = name to products like “laptop”, “PC monitor’ or “TV”

- The client contain main function will perform an order for product

Ex: Distributor com = new Factory():

String detall = com.orderProduct(‘Laptop’);

System.out print(detail);

Client

+main()

TV                                              interface Product                          Distributor

+getDetails() String               +getDetails():String               +order Product(String ProductName):Product

PC monitor                           Laptop                                     #Createproduct(Stringproductname): Product

+getDetails(): String            +getDetails(): String                 Factory

                                                                                                + createProduct(String productName): Product

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE