017-004-004

Interface Extension: Adding Functionality Through Inheritance

Medium

Problem Description

Interface Extension: Adding Functionality Through inheritance

In this problem, you will create a program that defines a Colorable interface extending Drawable, implements both in a Circle class, and calls setColor() and draw() methods, displaying the results to standard output.

Learning Objective: Understand that interfaces can extend other interfaces

Overview

Create a Colorable interface that extends Drawable interface, and create a class that implements both methods.

Specifications

  • Drawable interface: draw() method
  • Colorable interface: extends Drawable, adds setColor(String) method
  • Circle class: implements Colorable

Output Format

Color set to: Red
Drawing Circle

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
Expected Output:
Color set to: Red
Drawing Circle
Boundary case
Input:
Expected Output:
Color set to: Red
Drawing Circle
Error case
Input:
Expected Output:
Color set to: Red
Drawing Circle
problem.testType.comprehensive
Input:
Expected Output:
Color set to: Red
Drawing Circle

Your Solution

Current Mode: My Code
Drawable.java🔒
Colorable.java🔒
Circle.java🔒
Main.java🔒
4/6 ファイル149B
⚠️警告
  • No main method found
interface Drawable {
void draw();
}
0 B / 5 MB

You have 10 free executions remaining