Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

Does it have correct contact information?

Answered: 1 week ago