-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaesar.java
More file actions
38 lines (35 loc) · 922 Bytes
/
Caesar.java
File metadata and controls
38 lines (35 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public class Caesar
{
char[][]Caesar;
String Sentence;
int root;
public Caesar(String sentence)
{
Sentence = sentence;
int Root =(int) Math.sqrt(sentence.length());
root = Root;
Caesar = new char [root][root];
}
public void createArray(){
int y = 0;
if(root*root==Sentence.length()){
for(int r = 0; r<root; r++){
for(int c = 0;c<root;c++){
Caesar[r][c] = Sentence.charAt(y++);
System.out.print(" " + Caesar[r][c]);
}
System.out.println();
}
}else{
System.out.println("you messed up, try again");
}
}
public void message()
{
for(int r = 0; r<root; r++){
for(int c = 0;c<root;c++){
System.out.print(Caesar[c][r]);
}
}
}
}