Create an interface named Turner, with a single method called turn(). Then create 4 classes:
1 - Leaf: that implements turn(), which changes the color of the Leaf object and returns true. If for any reason it is unable to change color, it should return false (you can come up with a reason for failure). The new color can be determined at random.
2 - Document: that implements turn(), which changes the page on the document to the next page and returns true. If the current page is the last page of the document, then it returns false. This class should have a method called returnIdDate(), which returns a String containing the ID of the Document and the date it was published.
3 - Pancake: that implements turn(), which flips the pancake if it has not flipped before and returns true. If the pancake has already been flipped, then it returns false.
4 - Think of one more objects that can use turn(). Create the class and implement the turn() method. Show your creativity.
These should be complete classes with appropriate fields and methods (setters, getters, toString, and equals method)
Write an application, DemoTurners, which creates an array of 4 Turner objects and adds one object of each of these class types to it. Then demonstrate polymorphism by calling the turn() method on each object in a loop. Then print the Document object’s returnIdDate method using the Turner object.
NOTE: You need to show the polymorphism aspect of Interfaces.
*Attached Document is the same
6 freelancers are bidding on average $40 for this job
Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks
Dear Sir, I am Professional Software Developer, I am Linux Advanced Developer, I am Database Developer and designer. I can Handle your job and do everything extremely Grate. Regards,
Hi, I am a professional programmer with 10 years of experience. With so many programs written in Java, C, C++, C#, Delphi, and others (web programming too) I can complete your project. Thanks.