Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Interface CSIS-1410 Learning Objectives: Create an interface Implement an interface Demonstrate polymorphic behavior of interface:s Use the instanceof operator Develop algorithms (print methods) Description:

image text in transcribed
image text in transcribed
Assignment Interface CSIS-1410 Learning Objectives: Create an interface Implement an interface Demonstrate polymorphic behavior of interface:s Use the instanceof operator Develop algorithms (print methods) Description: This assignment demonstrates the use of interfaces and how they can be used in combination with inheritance. Use the four shapes that you implemented in Assignment Inheritance as a starting point. I recommend creating a copy before you implement any changes In this assignment you will create 2 interfaces: Shape and Printable and you will modify the classes Rectangle, Square, IsoscelesRightTriangle, and Circle so that they implement one or both of the interfaces In addition you will create a class called InterfaceApp (different from InheritanceApp). This class includes the main method and demonstrates the polymorphic behavior of interfaces Declare the interfaces according to the UML diagrams: Interface Shape: Interface perimeter)0: double area): double perimeter. returns the perimeter of the shape area. returns the area of the shape Interface Printable: print prints the outline of the shape with small circles (see output) within a line the stars are always separated by a single space (blank) The rectangle is printed with the length on the x-axis (more wide than high) In case of the triangle the right angle is on the bottom left (see output) The output produced by the print method needs to reflect the actual field values eInterface Printable print) Modify the four shape classes Rectangle, Square, IsoscelesRightTriangle, and Cirele so that . all of them are a Shape * all except Circle are a Printable Class InterfaceApp: This class include the main method. Output: Shape Aeray: .All arguments passed to the constructors are hard-coded in the main Rectangle (6x3) Perineter: 18.0 Area: 18.0 method (no user input) *Create an array of the interface type Shape and initialize it with two instances of Rectangle, Square, IsoscelesRightTriangle, and Circle (a total of 8 shapes) The rectangles have the sizes 6x3 and 5x4 The Rectangle (5x4) Perineter 18.0 Area: 20.0 squares have the sides 4 and 3 The triangles have the leg sizes S and 3 The circles have the radii 7 and 2 .Print the title "Shape Array: "and underline it with dashes Square 4) Perineter: 16.0 Area: 16.0 Loop though all the elements of the array For each of the array elements do the following: *print the shape (toString) print the perimeter print the area if the shape is printable, print the shape Hint: use instanceof to find out whether a shape is printable Square (3) Perimeter: 12.0 Area: 9. - *print a new line to structure the output isoscelesRight Trsangle (5 Perineter: 17.1 Area: 12.5 The output should look like the output provided on the right Video: Create a screen recording (1- 2 min) Start with your name. Have the editor pane wide open while calmly scrolling down the code (all classes) Point out any missing parts and known bugs in your code Then run the code (resize the panes so that all the output is visible o o o soscelesRight Triangle (3 Perineter: 10.2 Area: 4.5 Turning in: submit the video and a jar file that includes the source code cirele(7 Perineter: 44.0 Area: 153.9 cirele 12) Perineter: 12.6 Area: 12.6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

Students also viewed these Databases questions

Question

Were they made on a timely basis?

Answered: 1 week ago

Question

Did the decisions need to be made, or had they already been made?

Answered: 1 week ago