Skip to content
Sign upLog in
← Back to Community
flower garden
Profile icon
studentSakethSa

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

Voters
Profile icon
FinleySEATON
Profile icon
mzuniga17
Profile icon
Emilianohm
Profile icon
studentSakethSa
Comments
hotnewtop
Profile icon
rakeroon

Hello. If you are interested in cool garden creation, I can recommend to use professional help. Not all people know how to grow plants and how to create modern landscape design. Like example check https://avantilandscaping.ca/ company services, they can provide all necessary options for you!

Profile icon
Coder100

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

return s1[0];

Maybe you want to change the function signature instead?

Profile icon
studentSakethSa

@Coder100

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

Profile icon
Coder100

@studentSakethSa
public String[]

Profile icon
studentSakethSa

@Coder100

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