-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStand.java
More file actions
32 lines (23 loc) · 879 Bytes
/
Copy pathStand.java
File metadata and controls
32 lines (23 loc) · 879 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
package com.company;
import java.util.ArrayList;
/*
Stand Object: inventory(obj)
Stand Class methods: displayFruit(prints the information of all Fruits available)
*/
public class Stand {
//public static Fruit [] inventory = new Fruit[count + 1];
public static ArrayList<Fruit> inventory = new ArrayList<> ();
static void displayFruit(){
if (inventory.isEmpty ()) {
System.out.println ( "Inventory is Empty" );
} else if (inventory.size () == 1 )
{System.out.println ("The Stand has " + inventory.size () + " item in its inventory");
System.out.println (inventory);
}else { System.out.println ("The Stand has " + inventory.size () + " items in its inventory");
for (Fruit i:
inventory) {
System.out.println (i);
}
}
}
}