Question: Implement the following classes and interfaces An interface Drawable that contains a single method, draw() . This interface will be implemented by any classes representing

Implement the following classes and interfaces

An interface Drawable that contains a single method, draw(). This interface will be implemented by any classes representing game objects that you want to draw on the screen. This makes it so the game engine (which you dont need to write for this assignment) can treat every object you want to show on the screen as type Drawable, and it can simply call draw() on each of those objects to render it.

A class Spaceship that implements Drawable. For now, the draw() method can just display some text make this as simple or elaborate as you want!

An abstract class Weapon that contains instance variables for damage and load time. Weapon should also contain an abstract method fire(), and it should implement a Comparable interface by providing a compareTo(Comparable c) method based on the load time. Finally, Weapon should implement Drawable with the abstract method draw().

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!