Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in Java class Plant protected String name; public Plant (String name) this.namename; public String getName) return name; class Vegetable extends Plant protected String colour;
Code in Java
class Plant protected String name; public Plant (String name) this.namename; public String getName) return name; class Vegetable extends Plant protected String colour; protected double weightInkg; Complete two constructors in the subclass Write the Vegetable class in the answer box below assuming that the Plant class has been done for you in the Code Runner System. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result Vegetable v new Vegetable("Carrot", "orange", 0.2); System.out.printf("%s", v.getName()); Carrot vegetable v3 = new Vegetable( "Pea"); System . out . printf("%s", v3 . getName ( )); PeaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started