-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArrayList_gonz.java
83 lines (63 loc) · 1.44 KB
/
ArrayList_gonz.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//Brandon Gonzalez
//AList-Asg2: ArrayLists Bk Program
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Random;
public class ArrayLists_gonz {
public static void main(String[] args)
{
//7.3
ArrayList<Bell> myBells = new ArrayList<Bell>();
for(int i = 0; i < 10; i++)
}
private static void r7_3(ArrayList<Bell> myBell)
{
int min = myBell.get(0).id();
int max = myBell[0].id();
for(int i = 0; i < myBell.size(); ++i){
if(myBell.get(i).id() < min)
min = myBell.get(i).id()
if(myBell.get(i).id() > max)
max = myBell.get(i).id()
}
System.out.println("Min: " + min "; Max:" + max);
}
private static void r7_4()
{
Scanner myScanner = new Scanner(System.in);
ArrayList<String> myArray = new ArrayList<String>();
for(int i = 0; i < 10; ++i){
String myString = myScanner.nextLine();
myArray.add(myString);
}
for(int i = (myArray.size - 1); i > -1; --i){
System.out.println(myArray.get(i));
}
}
private static void r7_8()
{
ArrayList<Int> myArray = new ArrayList<Int>();
Random numGen = new Random();
for(int i = 0; i < 10; ++i){
myArray.add((numGen.nextInt(100) + 1));
}
}
}
class Bell {
private int studentId;
public Bell( int id ) {
studentId = id;
}
public int id() {
return studentId;
}
public int compareTo( Bell otherBell ) {
return this.id - otherBell.id;
}
}
class Polygon {
public double perimeter(){
}
public double area(){
}
}