018-002-008
Applied Polymorphism: Common Processing
Easy
Problem Description
Applied polymorphism: Common Processing
In this problem, you will create a program that implements the Describable interface in Book and Movie classes, and displays each object's description to standard output through a shared helper method.
Learning Objective: Understand how to apply common processing to different objects using polymorphism
Overview
Implement Describable interface in Book and Movie classes, and output different descriptions through the same method.
Specifications
- Declare
String describe()inDescribable BookreturnsBook: Java Programmingfromdescribe()MoviereturnsMovie: The Matrixfromdescribe()- In main, define a
showDescription(Describable d)helper method that printsDescription: <d.describe()> - Call with Book and Movie
Output Format
Description: Book: Java Programming
Description: Movie: The Matrix
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up