Question: 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:

JAVA: Write a class Apple.java, this class should be separate, but inthe same project as your test class AppleTest.java. AppleTest.java should have your

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 love

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!