Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in JAVA The Abstract Factory design pattern defines a template, or interface, for the creation of similar types of objects or implementations. Usually,

Please answer in JAVA The Abstract Factory design pattern defines a template, or interface, for the creation of similar types of objects or implementations. Usually, Abstract Factory will encapsulate a factory method or more within for the actual creation of the product. In the example below, you'll notice the presence of two abstract classes, Mobile (Product) and MobileStore (Creator). One family of concrete product implementations are AppleASeries, AppleBSeries and AppleCSeries, to be created by the AppleStore, which is the concrete implementation of the creator. In a similar fashion another family of products, such as PixelASeries, PixelBSeries and PixelCSeries, are to be created by GoogleStore, another concrete implementation of MobileStore. Provide implementations of any classes that are required to enableMobileStoreFactory to instantiate the concrete instance of the abstract factory (MobileStore) based upon the variable specified, either "Apple" (AppleStore) or "Pixel" (GoogleStore). The factory is then responsible for creating objects of similar types based on the choice  such as "ASeries" or "BSeries" or "CSeries". The mobile is then assembled based upon this by the MobileStore. You may use Main class to test your code. public interface Mobile { public default void chassis() { System.out.println("Default Chassis Included."); } public void experience(); public default void integrity() { System.out.println("Default Integrity Check."); } public default void box() { System.out.println("Default Box Packaging."); } public default void software(){ System.out.println("Default Software."); } } -------------------------- public class Main { public static void main(String... args) { MobileStore mobileStore = MobileStoreFactory.getMobileStore("Apple"); Mobile mobile = mobileStore.assemble("ASeries"); mobile.experience(); System.out.println(""); mobileStore = MobileStoreFactory.getMobileStore("Pixel"); mobile = mobileStore.assemble("BSeries"); mobile.experience(); } }

Step by Step Solution

3.46 Rating (166 Votes )

There are 3 Steps involved in it

Step: 1

java public interface MobileStore Mobile assembleString model public abstract class AbstractMobileStore implements MobileStore public Mobile assembleString model Mobile mobile createMobilemodel Add de... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: Loren A Nikolai, D. Bazley and Jefferson P. Jones

10th Edition

324300980, 978-0324300987

More Books

Students also viewed these Programming questions