Question: Need help with the JAVA code for this question @Override public Object grab() { // TODO Auto-generated method stub return null; } @Override public int

Need help with the JAVA code for this question

Need help with the JAVA code for this question @Override public Object

@Override

public Object grab() {

// TODO Auto-generated method stub

return null;

}

@Override

public int count(Object target) {

// TODO Auto-generated method stub

return 0;

}

@Override

public int removeAll(Object target) {

// TODO Auto-generated method stub

return 0;

}

@Override

public void clear() {

// TODO Auto-generated method stub

}

}

Java Driver for the program

Use the following driver program to test your Bag implementation (feel free to add your own code for sufficient testing):

public class BagDriver {

public static void main(String[] args){

Bag myBag = new Bag(10);

FamousPerson p1, p2, p3;

p1 = new FamousPerson("John", "McEnroe", 1980, "Tennis star.");

p2 = new FamousPerson("Herman", "Hollerith", 1860, "American scientist.");

p3 = new FamousPerson("John", "McEnroe", 2017, "Tennis announcer.");

System.out.println(myBag);

myBag.add(p1);

myBag.add(p2);

myBag.add(p3);

System.out.println(myBag);

System.out.println(myBag.grab());

System.out.println(myBag.count(p1));

System.out.println(myBag.removeAll(p1));

System.out.println(myBag); myBag.clear();

System.out.println(myBag);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!