Created
April 24, 2013 18:39
-
-
Save anonymous/5454445 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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