Skip to content

Commit 707dea1

Browse files
committed
add a decrypt case convert method
1 parent 36c66b2 commit 707dea1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/CaesarShift.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ public class CaesarShift {
44
private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Encapsulate and make the alphabet immutable
55
private static int key = 25; //Initialize and encapsulate the shift key
66
private static String encryptedMsg; //Create and encapsulate the message container
7+
private static String decryptedMsg;
78

8-
public String encrypt(String msg){
9-
String upCased = msg.toUpperCase();
9+
public String encrypt(String encryptMsg){
10+
String upCased = encryptMsg.toUpperCase();
1011
char[] upCasedArrs = upCased.toCharArray();//split the string to a character array
1112
ArrayList<Character> encryptedChars = new ArrayList<Character>();
1213

@@ -20,4 +21,8 @@ public String encrypt(String msg){
2021
return encryptedMsg;
2122
}
2223

24+
public String decrypt(String decryptMsg){
25+
return decryptMsg.toUpperCase();
26+
}
27+
2328
}

0 commit comments

Comments
 (0)