Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions