Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import java.util.*;
  2. //Your task is to complete this class
  3. public class MyBook implements IBook {
  4. //write the definition of method f1 here
  5. @Override
  6. public String f1(ArrayList<Book> a) {
  7. return a.get(0).name;
  8. }
  9.  
  10. //write the definition of method f2 here
  11. @Override
  12. public int f2(ArrayList<Book> a, int price) {
  13. int count=0;
  14. for (int i = 0; i< a.size(); i++){
  15. if (a.get(i).price >= price){
  16. count ++;
  17. }
  18. }
  19. return count;
  20. }
  21. //add and complete you other methods (if needed) here
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement