HI there
I tried to run this code as an example given by my teacher, butwhen I copied and tried to run, then it ask to createBagInterface and ArrayBag class.Do i have to do something more previously in order to run thiscode. Can anyone help me her please?
import java.util.Arrays;
public class BagTraceExample {
public static void main(String[] args) {
BagInterface<String> animalBag = newArrayBag();
System.out.println(animalBag.isEmpty());
animalBag.add(“alligator”);
animalBag.add(“bear”);
animalBag.add(“bear”);
animalBag.add(“cat”);
animalBag.add(“dog”);
animalBag.add(“elephant”);
System.out.println(animalBag.isEmpty());
animalBag.add(“cat”);
animalBag.add(“cat”);
System.out.println(animalBag.getCurrentSize());
System.out.println(animalBag.remove(“bear”));
System.out.println(animalBag.getCurrentSize());
System.out.println(animalBag.remove(“cat”));
System.out.println(animalBag.remove(“cat”));
animalBag.add(“cat”);
System.out.println(animalBag.remove(“gorilla”));
System.out.println(animalBag.getCurrentSize());
System.out.println(animalBag.getFrequencyOf(“cat”));
System.out.println(animalBag.contains(“gorilla”));
System.out.println(animalBag.getFrequencyOf(“gorilla”));
animalBag.clear();
System.out.println(animalBag.getCurrentSize());
System.out.println(animalBag.remove());
PayPal Gateway not configured
PayPal Gateway not configured