Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- //Your task is to complete this class
- public class MyBook implements IBook {
- //write the definition of method f1 here
- @Override
- public String f1(ArrayList<Book> a) {
- return a.get(0).name;
- }
- //write the definition of method f2 here
- @Override
- public int f2(ArrayList<Book> a, int price) {
- int count=0;
- for (int i = 0; i< a.size(); i++){
- if (a.get(i).price >= price){
- count ++;
- }
- }
- return count;
- }
- //add and complete you other methods (if needed) here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement