Using Java preferably with Eclipse
Task:
Write a program that creates a class Apple and a tester to makesure the Apple class is crisp and delicious.
Instructions:
First create a class called Apple
The class Apple DOES NOT HAVE a main method
Some of the attributes of Apple are
Type: A string that describes the apple.  It may onlybe of the following types:
 Red Delicious
 Golden Delicious
 Gala
 Granny Smith
Weight: A decimal value representing the apple’s weight inkilograms.  The weight must be between 0kg and 2kg
Price: The price per apple.  This must be anonÂnegative decimal value
Create the Default Constructor – sets everything to defaultvalues and has no parameters
Create Accessors and Mutators for each instance variable
MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!
Create the following Methods
toString() : Displays the values of the instance variables onthe console.
Finally create a class called AppleTester
This class DOES HAVE a main method
Create at least 3 different types of apples
Test if the accessors, mutators, and other methods work asintended.
Sample Output:
Welcome to the apple tester!!!
Creating the first apple!
Default values of the first apple object:
Type: Gala
Weight: 0.5 kg
Price: $0.88
Creating the second apple object!
Enter the type of the second apple object:
Granny Smith
Enter the weight of the second apple object:
0.7
Enter the price of the second apple object:
1.45
Values of the second apple object:
Type: Granny Smith
Weight: 0.7 kg
Price: $1.45
Creating the third apple object!
Enter the type of the third apple object:
Banana
Invalid value for type!
Enter the weight of the third apple object:
3.5
Invalid value for weight!
Enter the price of the third apple object:
Â2.22
Invalid value for price!
Printing the third apple’s values which should have not changedfrom the default values
Retrieving the third apple object's type:Gala
Retrieving the third apple object's weight:0.5 kg
Retrieving the third apple object's price:$0.88