Created
March 29, 2011 20:52
-
-
Save RobertoRodrigues/893252 to your computer and use it in GitHub Desktop.
Dojo 29/03/2011 Problema do Burger King
This file contains hidden or 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 { | |
String burguerKing(int caixa1, int caixa2, int drive) { | |
if((caixa1+1)*5+5 >= (caixa2+1)*5+5){ | |
if((caixa2+1)*5+5 >= (drive+1)*3 ){ | |
return "drive"; | |
}else | |
{ | |
return "caixa2"; | |
} | |
} else if((caixa1+1)*5+5 >= (drive+1)*3) { | |
return "drive"; | |
} | |
return "caixa"; | |
} | |
//****testes**** | |
public void teste_0_0_0() throws Exception { | |
assertEquals("drive",burguerKing(0,0,0)); | |
} | |
public void teste_1_1_0() throws Exception { | |
assertEquals("drive", burguerKing(1,1,0)); | |
} | |
public void teste_0_0_3() throws Exception{ | |
assertEquals("caixa", burguerKing(0,0,3)); | |
} | |
public void teste_0_0_4() throws Exception { | |
assertEquals("caixa", burguerKing(0,0,4)); | |
} | |
public void teste_2_2_3() throws Exception { | |
assertEquals("drive", burguerKing(2,2,3)); | |
} | |
public void teste_1_1_4() throws Exception { | |
assertEquals("drive",burguerKing(1,1,4)); | |
} | |
public void teste_1_0_4() throws Exception { | |
assertEquals("caixa2",burguerKing(1,0,4)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment