Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ball, game, gameTestProgram, player, prize trap, wall class are given. And please show result 1) The project begins with files that are used to represent

Ball, game, gameTestProgram, player, prize trap, wall class are given. And please show result image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1) The project begins with files that are used to represent a Game of Trap "ball tag" in which a Player (who is "it') chases other players around a Walled environment with a Ball and tries to hit them with it. When the a player gets hit with the ball. they become "it and try throw the ball at the other players. Each time a player hits another helshe gains points and when a player gets hit. Prize he/she loses points. Assume that the environment has rectangular walls that prevent Ball movement in certain directions. Also assume that there are Traps where a player cannot run into, otherwise he/she loses points. Lastly, assume that there are Prizes that the players can collect for bonus points while running around. Player Some classes for this game have been developed and they form the class hierarchy shown below: Object Ball Game Wall Player Prize Trap Examine the classes and look at the attributes (i.e., instance variables). You will notice that there is a lot of duplicate information. For example, Ball, Wall, Player, Prize and Trap all keep track of a location, and Ball and Player both have a direction and speed. This is not very nice. To eliminate the duplication, we will re-organize the classes by abstraction (i by extracting the common attributes and behaviors One way of doing this would be to see what all objects have in common. It seems that all objects except Game have a location. So we will begin by getting that information out from the objects and storing it in a common class which they can all inherit from. 1) The project begins with files that are used to represent a Game of Trap "ball tag" in which a Player (who is "it') chases other players around a Walled environment with a Ball and tries to hit them with it. When the a player gets hit with the ball. they become "it and try throw the ball at the other players. Each time a player hits another helshe gains points and when a player gets hit. Prize he/she loses points. Assume that the environment has rectangular walls that prevent Ball movement in certain directions. Also assume that there are Traps where a player cannot run into, otherwise he/she loses points. Lastly, assume that there are Prizes that the players can collect for bonus points while running around. Player Some classes for this game have been developed and they form the class hierarchy shown below: Object Ball Game Wall Player Prize Trap Examine the classes and look at the attributes (i.e., instance variables). You will notice that there is a lot of duplicate information. For example, Ball, Wall, Player, Prize and Trap all keep track of a location, and Ball and Player both have a direction and speed. This is not very nice. To eliminate the duplication, we will re-organize the classes by abstraction (i by extracting the common attributes and behaviors One way of doing this would be to see what all objects have in common. It seems that all objects except Game have a location. So we will begin by getting that information out from the objects and storing it in a common class which they can all inherit from

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

3. Evaluate a Web-based training site.

Answered: 1 week ago