Question: 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 ( )); Pea
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
