Skip to content

Instantly share code, notes, and snippets.

@RobertoRodrigues
Created March 29, 2011 20:52
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 RobertoRodrigues/893252 to your computer and use it in GitHub Desktop.
Save RobertoRodrigues/893252 to your computer and use it in GitHub Desktop.
Dojo 29/03/2011 Problema do Burger King
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