Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/evachenyr/M2
Browse files Browse the repository at this point in the history
  • Loading branch information
itscatherinelee committed Sep 6, 2018
2 parents ff4022d + cd45346 commit e711080
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 45 deletions.
9 changes: 9 additions & 0 deletions readme.p2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Naim Kabir
[email protected]

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
2 changes: 2 additions & 0 deletions readme.p3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Eva Chen
[email protected]
2 changes: 2 additions & 0 deletions readme.p4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name : Seonghun Kang
Email : [email protected]
8 changes: 5 additions & 3 deletions src/main/java/edu/gatech/oad/antlab/person/Person1.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* returns their name and a
* modified string
*
* @author Bob
* @author Catherine
* @version 1.1
*/
public class Person1 {
Expand All @@ -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;
}

/**
Expand Down
36 changes: 23 additions & 13 deletions src/main/java/edu/gatech/oad/antlab/person/Person2.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"));
}
}
20 changes: 12 additions & 8 deletions src/main/java/edu/gatech/oad/antlab/person/Person3.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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;
}
}
22 changes: 15 additions & 7 deletions src/main/java/edu/gatech/oad/antlab/person/Person4.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* A simple class for person 4
* returns their name and a
* modified string
*
* modified string
*
* @author Bob
* @version 1.1
*/
Expand All @@ -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".
Expand All @@ -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) {
Expand Down
24 changes: 16 additions & 8 deletions src/main/java/edu/gatech/oad/antlab/person/Person5.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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);
}

}
4 changes: 2 additions & 2 deletions src/main/java/edu/gatech/oad/antlab/pkg1/AntLabMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 0 additions & 1 deletion useless.p2.txt

This file was deleted.

2 changes: 0 additions & 2 deletions useless.p3.txt

This file was deleted.

1 change: 0 additions & 1 deletion useless.p4.txt

This file was deleted.

0 comments on commit e711080

Please sign in to comment.