Ask coding questions

← Back to all posts
flower garden

Create a class that stores an ArrayList of Strings.

The Strings store 2 bits of information about flowers.

The Strings store a count and a name.

You will need to use ParseInt.

“14 Daisy” there are 14 daisies.

“01 Rose” there is one rose.

There are numerous methods.

In order for this program to work correctly, several of the methods must call other methods.

For this problem, you need to make a FlowerGarden class.

The first and only instance variable will be an ArrayList < String >.
The FlowerGarden class will have one constructor that creates a new ArrayList.
The ArrayList stores Strings that store Flower information.
Each String has a count and a flower name.
"14 rose" there are 14 rose flowers in the garden.

The FlowerGarden class will have 8 methods.
The addFlower method adds a new flower to the arraylist - adds “00 flower name”
The findFlower will return the position in the arraylist where the flower is found
The getCount method returns how many of the particular flower is in the garden
The getFlowerName method returns the flower name at a particular position
The maxFlower method returns the name of the flower that exists the garden the most
The inRange method checks to see if a value is in a specified range
The ToString method will return the arraylist instance variable.

i did this code till here but i can not run it


Remember that s1 on line 27 is an array. Did you maybe mean

Maybe you want to change the function signature instead?


thank you for can you please tell which function signature do in use instead


@studentSakethSa public String[]


i will try that one out. and thank for your for my 2 assignment