diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..d529bcc --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ff20635 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5103107 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PlaylistChallenge.iml b/PlaylistChallenge.iml new file mode 100644 index 0000000..ea9ab4f --- /dev/null +++ b/PlaylistChallenge.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index bbd82c1..6402c2c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,17 +4,21 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.zipcoder - PlaylistChallenge + com.zipcodewilmington + loop_labs 1.0-SNAPSHOT + + 1.8 + 1.8 + junit junit 4.12 - test + \ No newline at end of file diff --git a/src/main/java/io/zipcoder/Music.java b/src/main/java/io/zipcoder/Music.java index 180c65c..547df24 100644 --- a/src/main/java/io/zipcoder/Music.java +++ b/src/main/java/io/zipcoder/Music.java @@ -9,6 +9,21 @@ public Music(String[] playList){ } public Integer selection(Integer startIndex, String selection){ - return null; + int counterForward = 0; + int counterBackward = 0; + for (int i = 0; i <= startIndex; i++) { + counterForward++; + } + for (int j = 0; j < playList.length; j++) { + counterBackward++; + } + if(counterForward < counterBackward){ + return counterForward; + } + else{ + return counterBackward; + + } + } } -} + diff --git a/target/classes/io/zipcoder/Music.class b/target/classes/io/zipcoder/Music.class new file mode 100644 index 0000000..06e143b Binary files /dev/null and b/target/classes/io/zipcoder/Music.class differ diff --git a/target/test-classes/io/zipcoder/MusicTest.class b/target/test-classes/io/zipcoder/MusicTest.class new file mode 100644 index 0000000..b23c799 Binary files /dev/null and b/target/test-classes/io/zipcoder/MusicTest.class differ