Skip to content

Instantly share code, notes, and snippets.

@yurenju
Last active May 3, 2018 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurenju/284cfb127a8ba9de07eb8e007acca317 to your computer and use it in GitHub Desktop.
Save yurenju/284cfb127a8ba9de07eb8e007acca317 to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
public class MeetupEvent {
private String title;
private int limit;
private ArrayList<String> attendees;
public MeetupEvent(String title, int limit) {
this.title = title;
this.limit = limit;
this.attendees = new ArrayList<String>();
}
public void register(String member) throws Exception {
if (this.attendees.size() < this.limit) {
this.attendees.add(member);
} else {
throw new Exception("ended");
}
}
public static void main(String[] args) throws Exception {
MeetupEvent event = new MeetupEvent("Ethereum Meetup Talk", 40);
event.register("Yuren Ju");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment