Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the code that will assign the variable 'myApple' a new Apple with code 'pl102', variety 'Pink Lady' and price per pound 1.49 //using this

Write the code that will assign the variable 'myApple' a new Apple with code 'pl102', variety 'Pink Lady' and price per pound 1.49

//using this code

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) {

}

}

//the code should be written in java.

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_2

Step: 3

blur-text-image_3

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

Students also viewed these Databases questions