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 05:00
This program will store roster and rating information for a soccer team. coaches rate players during tryouts to ensure a balanced team. (1) prompt the user to input five pairs of numbers: a player's jersey number (0 - 99) and the player's rating (1 - 9). store the jersey numbers in one int vector and the ratings in another int vector. output these vectors (i.e., output the roster). (3 pts) ex: enter player 1's jersey number: 84 enter player 1's rating: 7 enter player 2's jersey number: 23 enter player 2's rating: 4 enter player 3's jersey number: 4 enter player 3's rating: 5 enter player 4's jersey number: 30 enter player 4's rating: 2
Answers: 1
question
Computers and Technology, 22.06.2019 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
1. technician a says horsepower information can be used by consumers to compare the power of different automobile engines. technician b says that manufacturers will often list the horsepower output of their engines in the online service information. who is right?
Answers: 2
You know the right answer?
LAB: Plant information (ArrayList) Given a base Plant class and a derived Flower class, complete mai...
Questions
question
Mathematics, 24.06.2019 14:00
question
Mathematics, 24.06.2019 14:00
Questions on the website: 13722360