-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.java
More file actions
37 lines (29 loc) · 1.16 KB
/
Setup.java
File metadata and controls
37 lines (29 loc) · 1.16 KB
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
import bridges.connect.Bridges;
import bridges.base.Array;
import bridges.base.Element;
import bridges.base.ElementVisualizer;
public class Setup {
public static void main(String[] args) throws Exception {
/* Initialize a Bridges connection with your credentials */
/* TODO: plug your own BRIDGES credentials */
Bridges bridges = new Bridges(0, "ggurdin", "1179098021639");
/* Set an assignment title */
bridges.setTitle("Array Example Gabby Gurdin");
/* Set up the array dimensions, allocate an Array of Elements */
/* TODO: Make an array of size 10 */
int arraySize = 10;
Array<Integer> arr = new Array<Integer> (arraySize);
/* Populate the array with integers */
/* TODO: Make the array store square numbers*/
for (int i = 0; i < arr.getSize(); i++) {
arr.getElement(i).setLabel(String.valueOf(i * i));
ElementVisualizer vis = new ElementVisualizer();
arr.getElement(i).setVisualizer(vis);
vis.setColor("purple");
}
/* Tell BRIDGES which data structure to visualize */
bridges.setDataStructure(arr);
/* Visualize the Array */
bridges.visualize();
}
}