Commit 668a3213 authored by louie.bridges's avatar louie.bridges

Final Resub Commit.

parent 1f5e804b
import java.util.ArrayList; // import the ArrayList class 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> fibList = new ArrayList<Integer>();
//Adds 0 and 1 to the ArrayList
fibList.add(0);
fibList.add(1);
//For loop for the Fibonacci sequence.
for(int i =0; i<position; i++) {
fibList.add(fibList.get(fibList.size() -1)+fibList.get(fibList.size() -2));
} }
public String pigLatin(String message) return fibList.get(position - 1);
{
}
public String pigLatin(String message) {
String Newsentence = "";
String[] words;
Newsentence = message;
words = Newsentence.split(" ");
String sentence = "";
for(String letters : words) {
sentence += letters.substring(1) + letters.substring(0,1) + "ay ";
} }
return sentence.trim();
}
} }
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class ResitTest {
@BeforeAll
static void setUpBeforeClass() throws Exception {
}
@AfterAll
static void tearDownAfterClass() throws Exception {
}
@BeforeEach
void setUp() throws Exception {
}
@AfterEach
void tearDown() throws Exception {
}
@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