-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyBasket.java
48 lines (37 loc) · 1.43 KB
/
MyBasket.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
/*
* Name: David Rodriguez
* Section: COSC/ITSE 1336
* Homework: MyBasket
* Description: Easter Egg Basket code that displays different eggs with the ability to change the inside
*/
/*
* -------------------------------PSUDO CODE---------------------------------------------
* 1) Should be able load "MyEgg"
* 2) Should be able to change the symbols on the inside of the egg
* 3) Should display three eggs with different symbols in them using an array list
*---------------------------------------------------------------------------------------
*/
import java.util.*;
import java.util.io;
public class MyBasket {
ArrayList<MyEgg> aryMyBasket = new ArrayList<MyEgg>();
public static void main (String [] args){
Basket objMyBasket = new MyBasket();
MyEgg objAnEgg = new MyEgg('1');
objBasket.add(new MyEgg());
objBasket.add(new MyEgg('-'));
objBasket.add(new MyEgg('2'));
System.out.println(objBasket);System.out.println(objSingleEgg.compareTo(objSingleEgg));
System.out.println(objSingleEgg.compareTo(objBasket.get(0)));
System.out.println(objSingleEgg.compareTo(objBasket.get(2)));
}
public EasterEgg get(int intIndex) {
return aryBasket.get(intIndex);
}
public void add(EasterEgg objEgg) {
aryBasket.add(objEgg);
}
public String toString() {
return aryBasket.toString();
}
}