Builder

Report a typo

The given classes and interface are components of the Builder pattern.

GeekDirector creates geek-admin using the GeekBuilder class.

Implement the GeekBuilder method to compile the program and output the created geek.

Please do not change the provided code of the classes.

Sample Input 1:

Garry

Sample Output 1:

Geek Garry created.
Type : Admin
Languages : [Perl, PowerShell]
Experience : 10 years
Write a program in Java 25
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
* ConcreteComponent - Geek.
**/
class Geek {

private String type;
private List<String> languages;
private int experience;

public Geek(String type, List<String> languages, int experience) {
this.type = type;
this.languages = languages;
this.experience = experience;
}

@Override
public String toString() {
return "Type : " + type + "\n" + "Languages : " + languages + "\n" + "Experience : " + experience + " years";
}

}

/**
* Builder interface describe step of object creation.
**/
interface Builder {
void setType(String type);

void setLanguages(List<String> languages);

void setExperience(int experience);
}

Create a free account to access the full topic