Skip to content

Instantly share code, notes, and snippets.

@hnjaman
Last active July 8, 2018 12:25
Show Gist options
  • Save hnjaman/3acc7fa337842cc7c73695c0997de865 to your computer and use it in GitHub Desktop.
Save hnjaman/3acc7fa337842cc7c73695c0997de865 to your computer and use it in GitHub Desktop.
Factory pattern
public class BeautyParlor extends Service {
@Override
double getCost() {
return 5000;
}
@Override
String serviceStatus() {
return "Bride is ready and "+getCost()+" is your bill \n";
}
}
public class Cook extends Service {
@Override
double getCost() {
return 20000;
}
@Override
String serviceStatus() {
return "Items are ready and "+getCost()+" is your bill \n";
}
}
public class Decorator extends Service {
@Override
double getCost() {
return 10000;
}
@Override
String serviceStatus() {
return "Decoration is ready and "+getCost()+" is your bill \n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment