From 7e0f79ef5acc0075d0205216d44876cb2bcd50d6 Mon Sep 17 00:00:00 2001 From: Gillian Reynolds-Titko Date: Thu, 19 Jan 2017 17:32:24 -0500 Subject: [PATCH] Rotate array completed --- Reusing_Classes_Labs | 1 + pom.xml | 21 ++++++++ .../reynoldstitko/gillian/RotateArrays.java | 50 +++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 160000 Reusing_Classes_Labs create mode 100644 pom.xml create mode 100644 src/main/java/reynoldstitko/gillian/RotateArrays.java diff --git a/Reusing_Classes_Labs b/Reusing_Classes_Labs new file mode 160000 index 0000000..d82ae4f --- /dev/null +++ b/Reusing_Classes_Labs @@ -0,0 +1 @@ +Subproject commit d82ae4f16e5abbfc9629b602547dd4d22e216f12 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..64e2cae --- /dev/null +++ b/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + reynoldstitko.gillian + RotatingArrays + 1.0-SNAPSHOT + + + + + junit + junit + 4.12 + + + + + \ No newline at end of file diff --git a/src/main/java/reynoldstitko/gillian/RotateArrays.java b/src/main/java/reynoldstitko/gillian/RotateArrays.java new file mode 100644 index 0000000..91ea2a5 --- /dev/null +++ b/src/main/java/reynoldstitko/gillian/RotateArrays.java @@ -0,0 +1,50 @@ +package reynoldstitko.gillian; + +import java.util.ArrayList; +import java.util.*; + +/** + * Created by gillianreynolds-titko on 1/18/17. + */ +public class RotateArrays extends ArrayList { + + public void rotateArray(ArrayList inputArray, int k){ + System.out.println("Your input array is: "+ inputArray); + if(k > inputArray.size()){ + System.out.print("Choose k less than or equal to your array size"); + return; + } + + for(int i=0; i