Skip to content

Commit

Permalink
Person4
Browse files Browse the repository at this point in the history
  • Loading branch information
cskangGT committed Sep 6, 2018
1 parent 6e3dd33 commit 3f2e235
Showing 1 changed file with 15 additions and 7 deletions.
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

0 comments on commit 3f2e235

Please sign in to comment.