Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

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 Jun 09, 2021

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

Expert Solution

PFA

Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment