Skip to content

Instantly share code, notes, and snippets.

Created April 24, 2013 18:39
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 anonymous/5454445 to your computer and use it in GitHub Desktop.
Save anonymous/5454445 to your computer and use it in GitHub Desktop.
package Roulette;
import java.text.MessageFormat;
public class Outcome {
private String name;
private int odds;
public Outcome(String name, int odds){
this.name = name;
this.odds = odds;
}
public int winAmount(int amount){
return amount*this.odds;
}
public boolean equals(Outcome other){
return (this.name == other.name);
}
public String toString() {
Object[] values= { name, new Integer(odds) };
String msgTempl= "{0} ({1}:1)";
return MessageFormat.format( msgTempl, values );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment