Commit 2909d5fe authored by leon.bellerby's avatar leon.bellerby

Final Commit

parent 1f5e804b
...@@ -3,12 +3,32 @@ import java.util.ArrayList; // import the ArrayList class ...@@ -3,12 +3,32 @@ import java.util.ArrayList; // import the ArrayList class
public class ResitCode { public class ResitCode {
public int Fib_No(int position) { public int Fib_No(int position) {
ArrayList<Integer> list =new ArrayList<Integer>();
list.add(0);
list.add(1);
for(int i =0; i<position;i++) {
list.add(list.get(list.size()-1)+list.get(list.size()-2));
}
return list.get(position-1);
} }
public String pigLatin(String message) public String pigLatin(String message)
{ {
String newPig ="";
String[] word;
newPig=message;
word = newPig.split(" ");
String incredibilis = "";
for(String piglets : word) {
incredibilis += piglets.substring(1) + piglets.substring(0,1) + "ay ";
}
return incredibilis.trim();
} }
} }
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class ResitTest {
@Test
void test() {
fail("Not yet implemented");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment