0% found this document useful (0 votes)
115 views3 pages

In Programming Project 7 3 From Chapter 7 The Alien Class Was Rewritten To Use Inheritance The

The document discusses Programming Project 7.3 from Chapter 7 which rewrote the Alien class to use inheritance. The rewritten Alien class should be abstract since instances will never be created, only derived classes. The getDamage method should also be abstract. Testing is needed to ensure the rewritten class operates as expected.

Uploaded by

Charlotte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views3 pages

In Programming Project 7 3 From Chapter 7 The Alien Class Was Rewritten To Use Inheritance The

The document discusses Programming Project 7.3 from Chapter 7 which rewrote the Alien class to use inheritance. The rewritten Alien class should be abstract since instances will never be created, only derived classes. The getDamage method should also be abstract. Testing is needed to ensure the rewritten class operates as expected.

Uploaded by

Charlotte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

In Programming Project 7.

3 from Chapter 7, the Alien class


was rewritten to use inheritance. The...

In Programming Project 7.3 from Chapter 7, the Alien class was rewritten to use inheritance.
The rewritten Alien class should be made abstract because there will never be a need to create
an instance of it, only
GET THE ANSWER>> https://solutionlly.com/downloads/in-programming-project-7-3-from-
chapter-7-the-alien-class-was-rewritten-to-use-inheritance-the

In Programming Project 7.3 from Chapter 7, the Alien class was rewritten to use inheritance.
The rewritten Alien class should be made abstract because there will never be a need to create
an instance of it, only its derived classes. Change this to an abstract class and also make the
get Damage method an abstract method. Test the class from your main method to ensure that it
still operates as expected.

Programming Project 7.3

The following is some code designed by J. Hacker for a video game. There is an Alien class to
represent a monster and an Alien Pack class that represents a band of aliens and how much
damage they can inflict:

1/3
The code is not very object oriented and does not support information hiding in the Alien class.
Rewrite the code so that inheritance is used to represent the different types of aliens instead of
2/3
the “type” parameter. This should result in deletion of the “type” parameter. Also rewrite the
Alien class to hide the instance variables and create a get Damage method for each derived
class that returns the amount of damage the alien inflicts. Finally, rewrite the calculate Damage
method to use get Damage and write a main method that tests the code.

In Programming Project 7.3 from Chapter 7, the Alien class was rewritten to use inheritance.
The...
GET THE ANSWER>> https://solutionlly.com/downloads/in-programming-project-7-3-from-
chapter-7-the-alien-class-was-rewritten-to-use-inheritance-the

3/3
Powered by TCPDF (www.tcpdf.org)

You might also like