Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE IN JAVA Suppose we design a video game that manipulates objects of many different types, including objects of classes Martian, Venusian, Plutonian, SpaceShip and
PLEASE IN JAVA
Suppose we design a video game that manipulates objects of many different types, including objects of classes Martian, Venusian, Plutonian, SpaceShip and LaserBeam. Imagine that each class inherits from the common base class SpaceObject, which contains method Draw. Each derived class implements this method. The main method maintains a collection (e.g., an array or arrayList) of references to objects of the various classes. It sends each object the same messagenamely, Draw. However, each object responds in a unique way. For example, a Martian object might draw itself in red with the appropriate number of antennae. A SpaceShip object might draw itself as a bright silver flying saucer. A LaserBeam object might draw itself as a bright red beam across the screen or you can simply choose to describe the objects with text. Use your creativity!). Again, the same message (in this case, Draw) sent to a variety of objects has many forms of results. Your task is to implement the application: the base class SpaceObject and also the four derived classes. In the main method of your console application, make sure that you have the collection described above, with different objects of the derived classes. Call the method Draw() for each and every object in your collection and display the result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started