You will have an input and a factor.
Multiply the String by the factor.
For example: "hi",2 -> "hihi"
public class Kata{
public static String multiply(String input,int times){
String save = input;
for (int i = 1; i < times; i++) {
System.out.println(input);
input += save;
}
if(times == 0){
input = "";
}
return input;
}
}
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;
// TODO: Replace examples and use TDD development by writing your own tests
public class SolutionTest {
@Test
public void testSomething() {
assertEquals("lsadfkjlsadfkjlsadfkj",Kata.multiply("lsadfkj",3));
assertEquals("hellohellohellohello",Kata.multiply("hello",4));
assertEquals("",Kata.multiply("hu",0));
}
}