-
Notifications
You must be signed in to change notification settings - Fork 0
/
apClassMashup.java
executable file
·60 lines (53 loc) · 1.54 KB
/
apClassMashup.java
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//demo the use of a ArrayList on an object
//Miles Robertson
//Jan 12 2017
import java.util.ArrayList;
import java.util.*;
public class apClassMashup
{
public static void main( String args[] )
{
ArrayList<String>apclass;
apclass = new ArrayList<String>();
apclass.add("Manny");
apclass.add("Chanel");
apclass.add("Anu");
apclass.add("Gustavo");
apclass.add("Melanie");
apclass.add("Marcos");
apclass.add("Annie");
apclass.add("Ena");
apclass.add("Cullen");
apclass.add("Juan");
apclass.add("Astrid");
apclass.add("Ruth");
apclass.add("Peter");
apclass.add("Usam");
apclass.add("Cheyenne");
apclass.add("Lelaynia");
apclass.add("Miles");
apclass.add("Allen");
apclass.add("Yousef");
apclass.add("Martin");
apclass.add("Aidan");
apclass.add("Jalesa");
apclass.add("Jonas");
apclass.add("Crystal");
int rand = 0;
int num = 0;
int length = (int) (Math.random()* 5 + 3); //length of name
int x = 0;
for (int k = 0; k < length; k++)
{
rand = (int) (Math.random()* apclass.size() + 0); //random number (index of name chosen)
num = apclass.get(rand).length(); //length of chosen name
//System.out.println(rand);
if (k < num)
{
System.out.print(apclass.get(rand).charAt(k));
}
//System.out.println(rand);
//System.out.println(num);
}
}
}