38 lines
1023 B
Java
38 lines
1023 B
Java
package com.company.cars;
|
|
|
|
public class UniverseCarFactory {
|
|
protected String nameFactory;
|
|
|
|
public UniverseCarFactory(String NameFactory) {
|
|
nameFactory = NameFactory;
|
|
}
|
|
|
|
public Car produce(String type){
|
|
if(type == "SUV"){
|
|
Car suv = new SUV();
|
|
suv.setLogo(nameFactory);
|
|
suv.setModel("Suviaq");
|
|
return suv;
|
|
}
|
|
else if (type == "MVP") {
|
|
Car mvp = new MVP();
|
|
mvp.setLogo(nameFactory);
|
|
mvp.setModel("Familiaq");
|
|
return mvp;
|
|
}
|
|
else if(type == "Sportcar"){
|
|
Car sport =new Sportcar();
|
|
sport.setLogo(nameFactory);
|
|
sport.setModel("Sport");
|
|
return sport;
|
|
}
|
|
else if(type == "Littlecar"){
|
|
Car little =new Littlecar();
|
|
little.setLogo(nameFactory);
|
|
little.setModel("Little");
|
|
return little;
|
|
}
|
|
return null;
|
|
}
|
|
}
|