subject

LAB: Plant information (ArrayList) Given a base Plant class and a derived Flower class, complete main() to create an ArrayList called myGarden. The ArrayList should be able to store objects that belong to the Plant class or the Flower class. Create a method called printArrayList), that uses the printinfo methods defined in the respective classes and prints each element in myGarden. The program should read plants or flowers from input (ending with -1), adding each Plant or Flower to the myGarden ArrayList, and output each element in myGarden using the printinfo method Ex. If the input is: plant Spirea 10 flower Hydrangea 30 false lilac flower Rose 6 false white plant Mint 4 -1 the output is: Plant Information: Plant name: Spirea Cost: 10 Plant Information: Plant name: Hydrengea Cost: 30 Annual: false Color of flowers: lilac Microsoft Edge Plant Information: Plant name: Hydrengea Cost: 30 Annual: false Color of flowers: lilac Plant Information: Plant name: Rose Cost: 6 Annual: false Color of flowers: white Plant Information: Plant name: Mint Cost: 4 LAB ACTIVITY 9.18.1: LAB: Plant information (ArrayList) 10/10 Current file: PlantArrayListExample. java Load default template... 1 import java. util. Scanner; 2 import java. util. ArrayList; 3 import java. util. StringTokenizer; 4 5 public class PlantArrayListExample { 6 7 // TODO: Define a PrintArrayList method that prints an ArrayList of plant (or flower) objects 8

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
What provides an array of buttons for quick access to commonly used commands and tools
Answers: 1
You know the right answer?
LAB: Plant information (ArrayList) Given a base Plant class and a derived Flower class, complete mai...
Questions
question
Physics, 29.04.2021 17:00
question
Mathematics, 29.04.2021 17:00
Questions on the website: 13722367