Skip to content

Instantly share code, notes, and snippets.

View RobertoRodrigues's full-sized avatar
🏠
Working from home

Roberto Rodrigues RobertoRodrigues

🏠
Working from home
View GitHub Profile
@RobertoRodrigues
RobertoRodrigues / Carnaval
Created March 7, 2011 10:21
Dojo 04/03/2011
public class Carnaval
{
public static void main(String args[])
{
System.out.println ("Feliz FERIADO de Carnaval DOJO USP Leste! XD");
}
}
@RobertoRodrigues
RobertoRodrigues / Carnaval.java
Created March 7, 2011 10:23
Dojo 04/03/2011
public class Carnaval
{
public static void main(String args[])
{
System.out.println ("Feliz FERIADO de Carnaval DOJO USP Leste! XD");
}
}
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created March 20, 2011 20:31
Dojo 11/03/2011 problema: FizzBuzz
import junit.framework.TestCase;
public class Dojo extends TestCase {
String fizzbuzz(int entrada) {
if(entrada == 3){
return "fizz";
}
return ""+entrada;
}
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created March 20, 2011 20:43
Dojo 12/03/2011 Problema FizzBuzz alterado
import junit.framework.TestCase;
public class Dojo extends TestCase {
int fizzBuzz(int valor) {
if(valor==3||valor==5){
return 1;
}
return valor;
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created March 20, 2011 21:11
Dojo2 de 12/03/2011 FizzBuzz alterado
import junit.framework.TestCase;
public class Dojo extends TestCase {
int fizzBuzz(int valor) {
if(valor%3==0){
valor = valor/3;
}
if(valor%5==0){
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created March 22, 2011 22:18
Dojo 22/03/2011 Problema: Conversão de número decimal para Romano
import junit.framework.TestCase;
public class Dojo extends TestCase {
//****metodo para resolver o problema****
String convDecRoman(int decimal) {
String roman = "";
if (decimal == 9){
roman = "IX";
}
if(decimal <=8 && decimal>=5){
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created March 29, 2011 20:52
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
{
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created April 3, 2011 11:42
Dojo 02/04/2011 Problema Roleta Romana
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;
}
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created April 3, 2011 12:13
Dojo 01/04/2011 Problema Roleta Romana
import junit.framework.TestCase;
public class Dojo extends TestCase {
int roletaRomana(int n, int p, int i) {
if (p > 1 && (n==2 || n== 2*p || n==9 || n==4)) return i;
if (p==1 && i!=1) return i-1;
return n;
}
//****testes****
@RobertoRodrigues
RobertoRodrigues / Dojo.java
Created May 7, 2011 10:43
Problema de conversão de Digital para Decimal
//importa biblioteca JUnit para testes
import junit.framework.TestCase;
public class Dojo extends TestCase {
public static String zero = " _ \n| |\n|_|";
public static String um = " \n | \n | ";
public static String dois = " _ \n _|\n|_ ";
public static String tres = " _ \n _|\n _|";
//****metodo****