From 6b2d4f0a426080fa0cc4baaa4d244953d8c90707 Mon Sep 17 00:00:00 2001 From: val Date: Thu, 24 Oct 2019 16:09:54 -0400 Subject: [PATCH] Lab complete --- .idea/compiler.xml | 16 +++++++++++++ .idea/misc.xml | 13 +++++++++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 +++++ PlaylistChallenge.iml | 16 +++++++++++++ src/main/java/io/zipcoder/Music.java | 21 +++++++++++++++++- target/classes/io/zipcoder/Music.class | Bin 0 -> 842 bytes .../test-classes/io/zipcoder/MusicTest.class | Bin 0 -> 1381 bytes 8 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .idea/compiler.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 PlaylistChallenge.iml create mode 100644 target/classes/io/zipcoder/Music.class create mode 100644 target/test-classes/io/zipcoder/MusicTest.class diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..2bb69ef --- /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..d30d09e --- /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..0ddf51c --- /dev/null +++ b/PlaylistChallenge.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ 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..33f64c9 100644 --- a/src/main/java/io/zipcoder/Music.java +++ b/src/main/java/io/zipcoder/Music.java @@ -4,11 +4,30 @@ public class Music { private String[] playList; + // constructor public Music(String[] playList){ this.playList = playList; } public Integer selection(Integer startIndex, String selection){ - return null; + int counterA = 0; + int counterB = 0; + + + for(int i = 0; i <= startIndex; i++){ + counterA++; + } + for(int j = 0; j <= playList.length; j++){ + counterB++; + } + if(counterA > counterB){ + // return the less skip song options + return counterB; + } + else{ + return counterA; + } + + } } diff --git a/target/classes/io/zipcoder/Music.class b/target/classes/io/zipcoder/Music.class new file mode 100644 index 0000000000000000000000000000000000000000..b83d3b2be9d15a9321dcd4ab8462c9c50daf78fd GIT binary patch literal 842 zcmZuv%Wl&^6g^`*4;#15qY1BuQeI6`sew%vG%5;66_Em66lKH8aZQ-W*p=;6z`B0| z5?hdXiA6tv4Zi|E0Gx3{6N$?5_1rV(-h0lBzyJPr4B!qL7P43|kwMME6|AaoHHWnv zt_kE1eCJhP#)&}rX@Be-IxXJ`My{}&H}aybIcTb|F$eu)2?)uz$9F7X#fcLoy0E`wy?_!G_}iKcRgD%*Xg?xc5?f2{Gcv%Gu(O)26^6(V(PkreYVEEz(etPYKJ6ml)Sk zL6hIxIFB|iqJx!G>cdo8iOjP4;~AIJ6@{J3@3OW^*$OMLULD3gTp&+pO^4mev@bYE HDY^U?NR6ql literal 0 HcmV?d00001 diff --git a/target/test-classes/io/zipcoder/MusicTest.class b/target/test-classes/io/zipcoder/MusicTest.class new file mode 100644 index 0000000000000000000000000000000000000000..3a5845d28504d1de96f858cf44e777177bdaa963 GIT binary patch literal 1381 zcmcIjSx*yD6#j-zJ3}c21_3LJiVKvjf_p&}j7E|wi6tbBPnYSnTpVU_7F_<7FG@7} zu4d1>$qX#rj1)RZdNAPeu9iS+ct&!ws?JG2>JM zS9qHuRQldbn(?-Z3=CCNPZ%sRnjg!C3|ZBA%&K*_ zDvn8P`F4-8WS#zn8z;guP1?v~n8ktps7Cw3BdBrBj_P7|2$G zBy{CtrKgoY9>Sca&!GiZ)S>{xQHHpPWqPu&A{QapSKcEgJ*i` z6O0cGI&g;1%waNv0miwb0t{k^Hv?zc+;Q0a9VS0PVAcAHj#|n|RcoeWR%>Y|U9DxD zOtta_R&Dwd?5E}dI-fb2vYBR3PS4C1%#X;HGlg^^bAYZE^EhlGcA-Gtadcw>c}!FM zJmr@ue1+^<)srLUrm6yp>^Mhtfj?w8Q zqG`XEc^bI#S9dw>u3NjyYj^oJcd0{n`Ld~P{@dLUwVow=ff~DFXli literal 0 HcmV?d00001