Skip to content

Commit b52479d

Browse files
authored
Update MonoAlphabetic.java
1 parent dc5b5f0 commit b52479d

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/main/java/com/thealgorithms/ciphers/MonoAlphabetic.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,29 @@ public static void main(String[] args) {
66
System.out.println("Hello User! \nEnter your name:");
77
String name = read.nextLine();
88
read.nextLine();
9-
10-
System.out.println("Welcome " + name + "!\nDo you want to encrypt data or decrypt the data?\nFor encryption enter: 1\nFor decryption enter: 2"); int x = read.nextInt();
11-
read.nextLine();
9+
System.out.println("Welcome " + name + "!\nDo you want to encrypt data or decrypt the data?\nFor encryption enter: 1\nFor decryption enter: 2");
10+
int x = read.nextInt();
1211

1312
String key = "MNBVCXZLKJHGFDSAPOIUYTREWQ";
1413

1514
switch (x) {
16-
case 1:
17-
System.out.println("\nPlease enter the data that is to be encrypted, we will be using MonoAlphabetic Cipher to encrypt the data.");
18-
String data = read.nextLine().toUpperCase();
19-
String encryptedData = encrypt(data, key);
20-
System.out.println("Encrypted data: " + encryptedData);
21-
break;
15+
case 1:
16+
System.out.println("\nPlease enter the data that is to be encrypted, we will be using MonoAlphabetic Cipher to encrypt the data.");
17+
String data = read.nextLine().toUpperCase();
18+
String encryptedData = encrypt(data, key);
19+
System.out.println("Encrypted data: " + encryptedData);
20+
break;
2221

23-
case 2:
24-
System.out.println("\nPlease enter the data that is to be decrypted, we will be using MonoAlphabetic Cipher to decrypt the data.");
25-
data = read.nextLine().toUpperCase();
26-
String decryptedData = decrypt(data, key);
27-
System.out.println("Decrypted data: " + decryptedData);
28-
break;
22+
case 2:
23+
System.out.println("\nPlease enter the data that is to be decrypted, we will be using MonoAlphabetic Cipher to decrypt the data.");
24+
data = read.nextLine().toUpperCase();
25+
String decryptedData = decrypt(data, key);
26+
System.out.println("Decrypted data: " + decryptedData);
27+
break;
2928

30-
default:
31-
System.out.println("The input was invalid. Kindly restart.");
32-
break;
29+
default:
30+
System.out.println("The input was invalid. Kindly restart.");
31+
break;
3332
}
3433
}
3534

0 commit comments

Comments
 (0)