Question: JAVA HELP: Create a public interface Consolelo. The interface should declare two methods: updateFromConsole and writeToConsole. These methods should have neither parameters nor return values.

JAVA HELP:

JAVA HELP: Create a public interface Consolelo. The interface should declare two

methods: updateFromConsole and writeToConsole. These methods should have neither parameters nor return

Create a public interface Consolelo. The interface should declare two methods: updateFromConsole and writeToConsole. These methods should have neither parameters nor return values. Also, create a generic interface comparable GeometricFigure<...> which extends the built-in interface Comparable<...> and which ensures, using generics, that only objects of subclasses of GeometricFigure are comparable with each other (but it should not be restricted to comparing octagons, but should also be usable with other subclasses of GeometricFigure2). The code for GeometricFigure2 is supplied below. Create a class Octagon for regular octagons (symmetric octagons where all sides have the same length) which extends GeometricFigure2 and implements your interfaces Consolelo and ComparableGeometricFigure<...>. writeToConsole should print the field values and the area of the octagon. updateFromConsole should prompt the user interactively for a number (hint: java.util.Scanner) and update the side length of this octagon to this value. Your implementation of compare To in Octagon should compare two octagons in terms of their areas. Make sure that your compare To implementation can compare only octagons with each other, and that the Java compiler ensures this at compile time (again, using generics). Finally, add a static main method with some appropriate code which demonstrates the use of updateFromConsole, compare To and writeToConsole. abstract class GeometricFigure2 { public static final double PI = 3.141592653; private baslean filled; public GeometricFigure2() { filled = false; } public boolean isfitted) { return filled; } public void setFilled (kaalean filled) { this filled = filled; } public void display() { System.out.println("This is some geometric figure."); } public abstract double salsArea(); }

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!