Created
April 3, 2011 11:42
-
-
Save RobertoRodrigues/900376 to your computer and use it in GitHub Desktop.
Dojo 02/04/2011 Problema Roleta Romana
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
import junit.framework.TestCase; | |
public class Dojo extends TestCase { | |
//****metodo para resolver o problema**** | |
int roletaRomana(int p, int i) { | |
if (p==8) | |
return (i+6)%p; | |
return (i+1)%p; | |
} | |
//****testes**** | |
public void teste_8_3() throws Exception { | |
assertEquals(0,roletaRomana(8, 2)); | |
} | |
public void teste_8_1() throws Exception { | |
assertEquals(6,roletaRomana(8, 0)); | |
} | |
public void teste_8_2() throws Exception{ | |
assertEquals(7,roletaRomana(8, 1)); | |
} | |
public void teste_2_0() throws Exception{ | |
assertEquals(1,roletaRomana(2,0)); | |
} | |
public void teste_2_1() throws Exception { | |
assertEquals(0, roletaRomana(2, 1)); | |
} | |
public void teste_3_0() throws Exception { | |
assertEquals(1, roletaRomana (3, 0)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment