Question: JAVA Problem 5: Toy and ToyInventory Robert wants to get organized with a system to keep track of his toys. Implement two classes to help

JAVA
Problem 5: Toy and ToyInventory Robert wants to get organized with a system to keep track of his toys. Implement two classes to help him: Toy and ToyInventory. Toy must include the following public methods: Toy (String name, String description, boolean destroyed) // Constructor that constructs the Toy object o name: name of the toy o description: description of the toy o destroyed: whether or not this toy is destroyed String getName() // returns name void setName (String name) // sets the name to the given name String getDescription() // returns description void setDescription(String description) // sets the description to the given description boolean isDestroyed() // Returns true if the toy is destroyed, false otherwise void setDestroyed (boolean destroyed) // sets the destroyed property to the given value ToyInventory must include the following public methods: ToyInventory () // Constructor that constructs a new ToyInventory object void addToy (Toy toy) // adds the given toy if a toy with that name doesn't already exist in the inventory void removeToy (String name) // removes the toy with the given name if it exists in the inventory String getInventoryReport() // returns a string that lists the name, description, and DESTROYED or NOT DESTROYED for each toy (see example for formatting) Example: Toy lamby = new Toy("Lamby", "white fluffy stuffed lamb that I got for Christmas", false); Toy sharky = new Toy("Sharky", "blue shark with its mouth chewed off", true); Toy socky = new Toy("Socky", "my brother's old sock that I like to carry around in my mouth like a treasure", true); Toy tennisball = new Toy ("Tennis Ball", "standard green tennis ball that I play with outside", false); ToyInventory inventory = new ToyInventory (); inventory.addToy (lamby); inventory.addToy (sharky); inventory.addToy (socky); inventory.addToy (tennisBall); inventory.removeToy ("Sharky"); inventory.getInventoryReport(); // returns: Lamby white fluffy stuffed lamb that I got for Christmas NOT DESTROYED Socky my brother's old sock that I like to carry around in my mouth like a treasure DESTROYED Tennis Ball standard green tennis ball that I play with outside NOT DESTROYED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
