Question: Java Programming Exercise 1 Create an abstract class called GeometricShape. A GeometricShape may or may not be filled in. GeometricShape should contain a standard constructor

Java Programming

Exercise 1 Create an abstract class called GeometricShape. A GeometricShape may or may not be filled in. GeometricShape should contain a standard constructor and a default constructor that creates a filled in shape, as well as getters and setters for the instance data and a toString method.

Create two abstract methods: one for getting the area of a shape, and one for getting the perimeter of a shape.

Exercise 2 Modify Geometric shape so that it implements the comparable interface. Implement the compareTo() method, comparing shapes by their areas. The Comparable interface is part of the Java library, do not try to create the Comparable interface.

Exercise 3 Create a child class of GeometricShape, Rectangle. Rectangle has a width and a height. Those values should be positive integers. Rectangle should have an appropriate constructor for initializing instance data. Provide getters and setters for the data members and a toString method.

Exercise 4 Create an interface called ASCIIDrawable. The interface should have one unimplemented method, String drawAsASCII() which will return a String containing the object drawn using ASCII characters.

Exercise 5 Add 'implements ASCIIDrawable' to the Geometric shape class, but implement the drawAsASCII() functions in the Rectangle subclass. See the examples below for the expected output.

Exercise 6 Create a new class, Marquee, that represents a sign containing a message. It contains one String data member, message, a setter and getter for it, and a toString. It should implement the ASCIIDrawable interface. See the example below for the expected output. A marquee does not extend any of the previous classes.

Exercise 7 Create a tester class called FunWithShapes (not jUnit). Create an Array of GeometricShapes that contains several Rectangles.

Use Arrays.sort to demonstrate that your array of shapes is sorted asscendingly by area (it functions the same was as Collections.sort)

Create an array with the ASCIIDrawable interface type and use it to test the draw function of shapes and marquees.

Exercise 8 Create a comparator called ShapeComparator that compares GeometricShape objects by perimeter. In FunWithShapes, use the comparator to sort the array in descending order.

Java Programming Exercise 1 Create an abstract class called GeometricShape. A GeometricShape

Help me with exercise 5 and 6 . Thanks.

drawASASCII Examples (In order, unfilled Rectangle with height /width 3, filled rectangle with height /width 5, unfilled Rectangle with 7 width and 4 height, and a marquee Problems Javadoc Declaration Console X Coverage Square [Java Application] C:\Program Files\Java\jdk-11.0.1\bin\javaw ### # # ### ##### ##### ##### ##### ##### ####### ####### ################### # old Joe's Place # : ################### drawASASCII Examples (In order, unfilled Rectangle with height /width 3, filled rectangle with height /width 5, unfilled Rectangle with 7 width and 4 height, and a marquee Problems Javadoc Declaration Console X Coverage Square [Java Application] C:\Program Files\Java\jdk-11.0.1\bin\javaw ### # # ### ##### ##### ##### ##### ##### ####### ####### ################### # old Joe's Place # : ###################

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!