drawObject

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

In java, Please show output and comment code out

Imagine your project team is developing a Java application that will serve as an educational tool
to help children learn about various concepts such as vehicles, animals, sounds, etc. The
application will have a need to draw various objects (e.g., animals, vehicles) on the video
display as well as to rotate objects, resize objects, and play sounds that are associated with the
objects. Your project manager has specified that all objects in the application should use a
common interface for drawing, rotating, resizing, and playing sounds, and that these interfaces
should be reusable for other application projects as well. Some future applications will need to
make sounds, some will need drawing capability, some will need rotating capability, some will
need resizing capability, and some will need all capabilities. A method called drawObject() will
be used for drawing objects, a method called rotateObject() will be used for rotating objects, a
method called resizeObject() will be used for resizing objects, and a playSound() method will be
used for playing sounds.


1. Design the interface classes Drawable, Rotatable, Resizable and Sounds.


2. Develop a program called ManipulateAnimals that does the following: An Animal class
will be used to model some basic characteristics of animals for the application. An
animal will have a name attribute and methods to set the name and get the name.
Animals can make sounds and are drawable, rotatable, and resizable. A Vehicle class
will be used to model some basic characteristics of vehicles. A vehicle will have a name
and an age, and methods to get/set these attributes. Vehicles can also make sounds
and are drawable, rotatable, and resizable. Create a collection of 2 vehicles and 2
animals stored in the same array. Loop through the array and execute the drawObject(),
rotateObject(), resizeObject(), and playSound() methods polymorphically for each
element in the array. The drawObject() method should simply display the message
“Drawing a Vehicle” or “Drawing an Animal”; the rotateObject() method should display
the message “Rotating a Vehicle” or “Rotating an Animal”; and the playSound() method
should display the message “Animal sound” or “Vehicle sound”, depending upon the
type of element that is in the array. The resizeObject() method should display “Resizing
a Vehicle” or “Resizing an Animal”. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps with 9 images

Blurred answer
Knowledge Booster
Concept of Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education