define a plant subclass called flower using super method with two instance varia
ID: 2247733 • Letter: D
Question
define a plant subclass called flower using super method with two instance variables name and color. you must include constructor method that initializes each new variable to an appropriate value and functions for setting and getting. Plant class only holds constructor for species genus and family and has a class function that prints I'm a plant with set and get functions define a plant subclass called flower using super method with two instance variables name and color. you must include constructor method that initializes each new variable to an appropriate value and functions for setting and getting. Plant class only holds constructor for species genus and family and has a class function that prints I'm a plant with set and get functions define a plant subclass called flower using super method with two instance variables name and color. you must include constructor method that initializes each new variable to an appropriate value and functions for setting and getting. Plant class only holds constructor for species genus and family and has a class function that prints I'm a plant with set and get functionsExplanation / Answer
public class Plant{ private String name; private String id; private String color; public Plant(String name, String id, String color){ this.name = name; this.id = id; this.color = color; } public String getName(){ return this.name; } public void setName(String name){ name = this.name; } public String getId(){ return this.id; } public void setId(String id){ id = this.id; } public String getColor(){ return this.color; } public void setColor(String color){ color = this.color; } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.