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

Code in Java class Plant protected String name; public Plant (String name)

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!