diff --git a/readme.p2.txt b/readme.p2.txt new file mode 100644 index 0000000..ecfeab5 --- /dev/null +++ b/readme.p2.txt @@ -0,0 +1,9 @@ +Naim Kabir +akabir6@gatech.edu + +Each team member should add a text file on the master branch to the top level directory labeled readme.pn.txt +where the pn would be p1, p2, p3, p4 or p5 based upon which person you are for the lab. +The contents of the file can really be anything, but should include your name and email. +Each team member should delete the text file useless.pn.txt where pn is p1,p2, p3, p4 or p5 based on your team member number. +Do NOT delete the wrong files!!Use good descriptive Log comments for your changes/commitsRoll back changes by viewing (checkout) your original branch from an earlier step. +Verify that none of the changes you have made are in the original branch project version you checked out \ No newline at end of file diff --git a/readme.p3.txt b/readme.p3.txt new file mode 100644 index 0000000..5158548 --- /dev/null +++ b/readme.p3.txt @@ -0,0 +1,2 @@ +Eva Chen +ychen840@gatech.edu diff --git a/readme.p4.txt b/readme.p4.txt new file mode 100644 index 0000000..11ffe19 --- /dev/null +++ b/readme.p4.txt @@ -0,0 +1,2 @@ +Name : Seonghun Kang +Email : cskang@gatech.edu diff --git a/src/main/java/edu/gatech/oad/antlab/person/Person1.java b/src/main/java/edu/gatech/oad/antlab/person/Person1.java index 56f6227..c609f66 100755 --- a/src/main/java/edu/gatech/oad/antlab/person/Person1.java +++ b/src/main/java/edu/gatech/oad/antlab/person/Person1.java @@ -5,7 +5,7 @@ * returns their name and a * modified string * - * @author Bob + * @author Catherine * @version 1.1 */ public class Person1 { @@ -30,8 +30,10 @@ public Person1(String pname) { * @return the modified string */ private String calc(String input) { - //Person 1 put your implementation here - return null; + + String a = input.substring(input.length() - 2, input.length()); + String b = input.substring(0, input.length() - 2); + return a + b; } /** diff --git a/src/main/java/edu/gatech/oad/antlab/person/Person2.java b/src/main/java/edu/gatech/oad/antlab/person/Person2.java index 5e03d90..49a163f 100755 --- a/src/main/java/edu/gatech/oad/antlab/person/Person2.java +++ b/src/main/java/edu/gatech/oad/antlab/person/Person2.java @@ -1,24 +1,25 @@ package edu.gatech.oad.antlab.person; +import java.util.Random; /** * A simple class for person 2 * returns their name and a - * modified string + * modified string * - * @author Bob - * @version 1.1 + * @author Naim Kabir + * @version 1.0 */ public class Person2 { - /** Holds the persons real name */ - private String name; - /** + /** Holds the persons real name */ + private String name; + /** * The constructor, takes in the persons * name * @param pname the person's real name */ - public Person2(String pname) { - name = pname; - } + public Person2(String pname) { + name = pname; + } /** * This method should take the string * input and return its characters in @@ -30,18 +31,27 @@ public Person2(String pname) { * @return the modified string */ private String calc(String input) { - //Person 2 put your implementation here - return null; + String addIt = ""; + Random random = new Random(); + for (int i = 0; i < input.length() ; i++) { + int index = random.nextInt(input.length()); + addIt += input.charAt(index); + } + return addIt; } /** * Return a string rep of this object * that varies with an input string * * @param input the varying string - * @return the string representing the + * @return the string representing the * object */ public String toString(String input) { - return name + calc(input); + return name + calc(input); + } + public static void main(String[] args) { + Person2 a = new Person2("Cat"); + System.out.println(a.calc("Cat")); } } diff --git a/src/main/java/edu/gatech/oad/antlab/person/Person3.java b/src/main/java/edu/gatech/oad/antlab/person/Person3.java index 48e3eaa..44aafd3 100755 --- a/src/main/java/edu/gatech/oad/antlab/person/Person3.java +++ b/src/main/java/edu/gatech/oad/antlab/person/Person3.java @@ -2,15 +2,15 @@ /** * A simple class for person 3 * returns their name and a - * reversed string - * + * reversed string + * * @author Bob * @version 1.1 */ public class Person3 { - /** Holds the persons real name */ + /** Holds the persons real name */ private String name; - + /** * The constructor, takes in the persons * name @@ -19,19 +19,19 @@ public class Person3 { public Person3(String pname){ name = pname; } - + /** * Return a string rep of this object * that varies with an input string * * @param input the varying string - * @return the string representing the + * @return the string representing the * object */ public String toString(String input) { return name + calc(input); } - + /** * This method should take the string * input and return its reverse. @@ -43,6 +43,10 @@ public String toString(String input) { */ private String calc(String input) { //Person 3 put your implementation here - return null; + String reversed = new String(""); + for (int i = input.length() - 1; i >= 0; i--) { + reversed = reversed + input.charAt(i); + } + return reversed; } } diff --git a/src/main/java/edu/gatech/oad/antlab/person/Person4.java b/src/main/java/edu/gatech/oad/antlab/person/Person4.java index dce18e7..50e19e5 100755 --- a/src/main/java/edu/gatech/oad/antlab/person/Person4.java +++ b/src/main/java/edu/gatech/oad/antlab/person/Person4.java @@ -3,8 +3,8 @@ /** * A simple class for person 4 * returns their name and a - * modified string - * + * modified string + * * @author Bob * @version 1.1 */ @@ -21,7 +21,7 @@ public Person4(String pname) { } /** * This method should return a string - * where each character is 1 greater + * where each character is 1 greater * than its previous value. So * given "abc123" it should return * "bcd234". @@ -30,16 +30,24 @@ public Person4(String pname) { * @return the modified string */ private String calc(String input) { - //Person 4 put your implementation here - return null; + String str = new String(""); + + for(int i = 0 ; i < input.length(); i++) { + + char prev = input.charAt(i); + int iprev = (int) prev + 1; + char nextI = (char) iprev; + str = str + nextI; + } + return str; } - + /** * Return a string rep of this object * that varies with an input string * * @param input the varying string - * @return the string representing the + * @return the string representing the * object */ public String toString(String input) { diff --git a/src/main/java/edu/gatech/oad/antlab/person/Person5.java b/src/main/java/edu/gatech/oad/antlab/person/Person5.java index 6cf1dd1..a34a203 100755 --- a/src/main/java/edu/gatech/oad/antlab/person/Person5.java +++ b/src/main/java/edu/gatech/oad/antlab/person/Person5.java @@ -1,11 +1,11 @@ package edu.gatech.oad.antlab.person; /** - * A simple class for person 5 + * A simple class for Samuel Thomas * returns their name and a - * modified string - * - * @author Bob + * modified string + * + * @author Samuel Thomas * @version 1.1 */ public class Person5 { @@ -31,19 +31,27 @@ public Person5(String pname) { */ private String calc(String input) { //Person 5 put your implementation here - return null; + String str1 = input.substring(0,2); + String str2 = input.substring(2); + return str2 + str1; + } - + /** * Return a string rep of this object * that varies with an input string * * @param input the varying string - * @return the string representing the + * @return the string representing the * object */ public String toString(String input) { - return name + calc(input); + return name + calc(input); } + public static void main(String[] args) { + Person5 person5 = new Person5("Samuel Thomas"); + System.out.println(person5); + } + } diff --git a/src/main/java/edu/gatech/oad/antlab/pkg1/AntLabMain.java b/src/main/java/edu/gatech/oad/antlab/pkg1/AntLabMain.java index 680f0ab..cd5292f 100755 --- a/src/main/java/edu/gatech/oad/antlab/pkg1/AntLabMain.java +++ b/src/main/java/edu/gatech/oad/antlab/pkg1/AntLabMain.java @@ -61,8 +61,8 @@ public void printOutMessage() { toPrint += p1.toString("gburdell1"); //Person2 replace P2 with your name //and gburdell with your gt id - Person2 p2 = new Person2("P2"); - toPrint += p2.toString("gburdell2"); + Person2 p2 = new Person2("Naim Kabir"); + toPrint += p2.toString("akabir6"); //Person3 replace P3 with your name //and gburdell3 with your gt id Person3 p3 = new Person3("P3"); diff --git a/useless.p2.txt b/useless.p2.txt deleted file mode 100755 index ec5a801..0000000 --- a/useless.p2.txt +++ /dev/null @@ -1 +0,0 @@ -more useless info to delete diff --git a/useless.p3.txt b/useless.p3.txt deleted file mode 100755 index 65e2b95..0000000 --- a/useless.p3.txt +++ /dev/null @@ -1,2 +0,0 @@ -even still more useless info to delete - diff --git a/useless.p4.txt b/useless.p4.txt deleted file mode 100755 index afeda10..0000000 --- a/useless.p4.txt +++ /dev/null @@ -1 +0,0 @@ -Last bit of useless stuff \ No newline at end of file