Question
//The second constructor in Apple is not complete. //Write the code for that constructor public Apple(String code) { } Information public class Fruit { private
//The second constructor in Apple is not complete. //Write the code for that constructor
public Apple(String code) {
}
Information
public class Fruit {
private double pricePerPound;
private String code;
public Fruit(double pricePerPound, String code) {
this.pricePerPound = pricePerPound;
this.code = code;
}
public Fruit(String code) {
this.code = code;
}
}
public class Apple extends Fruit {
private String variety;
public Apple(double pricePerPound, String code, String variety) {
}
public Apple(String code) {
}
}
//This program should be in java format.
Step 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