Question: Now we are going to use the design pattern for collecting objects. We are going to model a GardenStore with plants. A GardenStore uses an

Now we are going to use the design pattern for collecting objects. We are going to model a GardenStore with plants. A GardenStore uses an ArrayList to keep track of Plant objects. You will write both a GardenStore class and a Plant class.

A Plant has a name and a price. Provide a constructor that takes name and price, in that order. Provide getters and setters for the instance variables. This is the design pattern for managing properties of objects.

A GardenStore has a constructor that takes no parameters. Remember it must initialize the instance variable

It has methods

add() Adds the specified Plant to the GardenStore

sum() Finds the total cost of all Plants in the GardenStore

contains() determines if a Plant with a given name is in the GardenStore. Returns true if a Plant with that name is in the GardenStore. Otherwise false.

plantList() gets an ArrayList names of the Plants in the GardenStore.

Provide Javadoc for both classes.

Please use this link to check for answer: http://www.codecheck.it/files/17080124457bkcuvomgowcwweyptvxhwr0b

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!