package phone;
public class Test {
public static void main(String[] args) {
PhoneFactory xiaomiPhoneFactory=new XiaomiFactory();
PhoneFactory huaweiPhoneFactory=new HuaweiFactory();
Phone xiaomi=xiaomiPhoneFactory.orderPhone("Xiaomi");
Phone huawei=huaweiPhoneFactory.orderPhone("Huawei");
xiaomi.display();
PhoneComponent component1=new PhoneComponent();
PhoneComponentFactory componentFactory1=component1.ctreatePhoneComponent("Xiaomi");
componentFactory1.createCharger().has();
componentFactory1.createCase().with();
componentFactory1.createEarPhone().and();
huawei.display();
PhoneComponent component2=new PhoneComponent();
PhoneComponentFactory componentFactory2=component2.ctreatePhoneComponent("Huawei");
componentFactory2.createCharger().has();
componentFactory2.createCase().with();
componentFactory2.createEarPhone().and();
}
}