Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package christmas;
- public class Main {
- public static void main(String[] args) {
- Bag bag = new Bag("black", 10);
- // Initialize entity
- Present present = new Present("Doll", 0.4, "girl");
- // Print Present
- System.out.println(present); // Present Doll (0.40) for a girl
- // Add Present
- bag.add(present);
- // Remove Present
- bag.remove("Toy"); // false
- Present secondPresent = new Present("Train", 2, "boy");
- // Add Present
- bag.add(secondPresent);
- Present heaviestPresent = bag.heaviestPresent();
- System.out.println(heaviestPresent);
- // Present Train (2.00) for a boy
- // Present p = bag.getPresent("Doll");
- // System.out.println(p);
- // Present Doll (0.40) for a girl
- System.out.println(bag.count()); // 2
- // System.out.println(bag.report());
- // Black bag contains:
- // Present Doll (0.40) for a girl
- // Present Train (2.00) for a boy
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement