Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA: Write a class Apple.java, this class should be separate, but in the same project as your test class AppleTest.java. AppleTest.java should have your public
JAVA:
Write a class Apple.java, this class should be separate, but in the same project as your test class AppleTest.java. AppleTest.java should have your public static void main method and also complete the requirements noted below under "Test Class" All skills used in this program are in Chapter 9, except for the extra credit which is in Chapter 8 (sorting an array), though the extra credit will be a challenge as you are dealing with an Array of Objects Constructors: Blank constructor () that defaults the apple to empty values for name and love story and zero for established. Two parameter constructor (String name, int established) that sets the name and established value (established cannot be negative), and sets love story to empty. Three parameter constructor (String name, int established, String lovestory) that sets all three attributes. ensure that the established date is valid if you are setting it within the constructor, if it's not valid (e.g. negative or before year 1700, choose a default established date) Private Attributes: o name o established o love story Public Methods: Getter/Setter for all attributes (properly named) o In the established setter method ** ensure that the established date is valid itf you are setting it within the constructor, if it's not valid (e.g. negative or before year 1700, choose a default established date) o print() or toString() that prints a string version of the apple (name, established and loveStep 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