package edu.columbia.cs.cs1007.comics;
import java.util.TreeSet;
/**
* An implementation of the driver class for the Superhero application.
* @author Julia Stoyanovich (jds2109@columbia.edu)
* COMS 1007, Summer 2009
*
*/
public class Armageddon {
public static void main(String[] args) {
TreeSet<SuperHero> heroes = new TreeSet<SuperHero>();
TreeSet<Villain> villains = new TreeSet<Villain>();
heroes.add(new StrongSuperHero("The Hulk"));
heroes.add(new StrongSuperHero("Colossus"));
heroes.add(new MagicalSuperHero("Doctor Strange"));
villains.add(new Villain("Green Goblin", "eveyone", "I'm crazy and vengeful"));
villains.add(new Villain("Joker", "people", "I was abused as a child"));
villains.add(new Villain("Doctor Evil", "the world", "I'm evil"));
while (!heroes.isEmpty() && !villains.isEmpty()) {
// More TreeSet methods at http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html
SuperHero hero = heroes.pollFirst();
Villain villain = villains.pollFirst();
System.out.println("\n===>" + hero.getName() + " against " + villain.getName() + "<===");
System.out.println(hero.saveTheWorld(villain));
}
}
}
|