Below is what I have to complete, and the program is what i have done so far. I am having problems with the red items. Can someone let me know what might be wrong and di I have everything I should! Thank you in advance!
1.-Need to write the exact same program.
C. Write a program, which consists of following three classes and one interface.
• Class Fruit with following members:
o protected String color;
o protected double weight;
o public abstract String getColor();
o public abstract double getWeight();
• Interface Edible has only one abstract method getTaste().
• An Apple class inherits Fruit and implements Edible.
• A test class called TestApple will create an instance of Apple and call all above abstract methods and print out an apple object’s color, weight, and taste.
Moderator Edit: Code tags addedCode:
public class Fruit
private String color;
private double weight;
Fruit(String color, double weight)
public String getcolor()
public double getweight()
public interface Edible
public abstract void getTaste();
class Apple extends Fruit
public String getTaste()
public class TestApple
public void main(String args)
[COLOR="red"]Apple Apple1 = newApple();[/COLOR]
[COLOR="red"]System.out.println ("Apple Color is: " + Fruit.getColor() );[/COLOR]
[COLOR="red"]System.out.println ("Apple Weight is: " + Fruit.getWeight() );[/COLOR]
[COLOR="red"]System.out.println ("Apple Taste is: " + Fruit.getTaste() + ".");[/COLOR]