Question: Use Java 8 import java.util.ArrayList; import java.util.List; public abstract class Trader { private List inventory; private List wishlist; private double money; private boolean bilingual; //
Use Java 8

import java.util.ArrayList; import java.util.List;
public abstract class Trader { private List inventory; private List wishlist; private double money; private boolean bilingual;
// INSERT CODE HERE
}
Polymorphism: trade problem 713 There are human traders and alien traders. Regardless of species, traders can trade but they need to be careful on exchanging money since currencies of humans and aliens are different. If two traders can't communicate, they can't trade. Define an abstract class Trader with: four private instance variables: - inventory (List) - wish list (List) - money (double) - bilingual (boolean) a constructor that has three parameters that represent this Trader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean); initialize wish list to an empty ArrayList an abstract method called isHuman that returns true if and only if this Trader is a human a method called addToWishlist that takes Tradable and returns nothing a method called sellTo that takes Trader and returns true if and only if both Traders can communicate; if both Traders can communicate, trade can be made by the following: if any Tradable item in this Trader's inventory is in the input Trader's wish list and the input Trader has enough money to pay, remove the item from this Trader's inventory, and the input Trader's wish list and add it to the input Trader's inventory; update both Traders' money with appropriate currency a method called buy From that takes Trader and returns true if and only if both Traders can communicate; If both Traders can communicate, trade can be made by the following: if any Tradable item in this Trader's wish list is in the input Trader's inventory and this Trader has enough money to pay, remove the item from the input Trader's inventory, and this Trader's wish list and add it to this Trader's inventory; update both Traders' money with appropriate currency (hint: you can use sellTo method here) Do not define getters Define a class AlienTrader that extends Trader with: a constructor that has three parameters that represent this AlienTrader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean) an implementation of is Human Define a class HumanTrader that extends Trader with: a constructor that has three parameters that represent this HumanTrader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean) an implementation of is Human Polymorphism: trade problem 713 There are human traders and alien traders. Regardless of species, traders can trade but they need to be careful on exchanging money since currencies of humans and aliens are different. If two traders can't communicate, they can't trade. Define an abstract class Trader with: four private instance variables: - inventory (List) - wish list (List) - money (double) - bilingual (boolean) a constructor that has three parameters that represent this Trader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean); initialize wish list to an empty ArrayList an abstract method called isHuman that returns true if and only if this Trader is a human a method called addToWishlist that takes Tradable and returns nothing a method called sellTo that takes Trader and returns true if and only if both Traders can communicate; if both Traders can communicate, trade can be made by the following: if any Tradable item in this Trader's inventory is in the input Trader's wish list and the input Trader has enough money to pay, remove the item from this Trader's inventory, and the input Trader's wish list and add it to the input Trader's inventory; update both Traders' money with appropriate currency a method called buy From that takes Trader and returns true if and only if both Traders can communicate; If both Traders can communicate, trade can be made by the following: if any Tradable item in this Trader's wish list is in the input Trader's inventory and this Trader has enough money to pay, remove the item from the input Trader's inventory, and this Trader's wish list and add it to this Trader's inventory; update both Traders' money with appropriate currency (hint: you can use sellTo method here) Do not define getters Define a class AlienTrader that extends Trader with: a constructor that has three parameters that represent this AlienTrader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean) an implementation of is Human Define a class HumanTrader that extends Trader with: a constructor that has three parameters that represent this HumanTrader's initial amount of money (double), initial inventory (List), and ability to speach both English and Alien (boolean) an implementation of is Human