Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Explore the given classes. Implement a getter method on the wasteRobot class with the following method signature public ArrayList-waste> getwasteBin(string wasteType) The method should return
Explore the given classes. Implement a getter method on the wasteRobot class with the following method signature public ArrayList-waste> getwasteBin(string wasteType) The method should return the proper waste bin based on the passed wasteType. Compare the given wasteType to each of the public static final constants in the waste class to help determine which bin to return. import java.util.* public class WasteRobot private ArrayList trashBin; private ArrayList compostBin; private ArrayList recyclingBin; public WasteRobot() trashBin-new ArrayList- compostBn = new ArrayListWaste>(); recyclingeln = new ArrayListWaste>(); trashBin.add(new Trash("Plastic Bag")); compostBin.add (new Compost ("Banana Peel")); recyclingBin. add(new Recycling("Soda Can")); Implement this! // getwasteBin(String wasteType) public abstract class Waste public static final String TRASH TYPE "trash"; public static final String COMPOST_TYPE"compost"; public static final String RECYCLING_TYPE"recycling"; private String wasteType; private String wasteName; public Waste(String wasteType, String wasteName) this.wasteType wasteType; this.wasteName wasteName; public String getwasteType) return wasteType; public String toString() return wasteType+ ":"wasteName
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started