Final Exam Project For the final exam project, you will develop a game application called “Hungry Squirrel”. In this game, there is a Squirrel in a maze looking for nuts. You will guide the squirrel...

need to complete the attached


Final Exam Project For the final exam project, you will develop a game application called “Hungry Squirrel”. In this game, there is a Squirrel in a maze looking for nuts. You will guide the squirrel to find and eat the nuts. There are two types of nuts available in the maze, Almonds and Peanuts. The squirrel gains nutritional points as it finds and eats the nuts. Once it finds all the nuts in the maze, the game is over. To implement this game, you shall define 8 classes: Maze class, Entity class, Squirrel class, Wall class, Nut class, Almond class, Peanut class, and HungrySquirrelGame class. Each class is described in details in the following sections. The following class diagram shows the class hierarchy that must be implemented: Entity Wall Squirrel Nut Almond Movable Peanut In this document, you find each class described in details. There is enough information to help you implement this game. The class description does not provide all the details such as Constructors, setter/getter methods or toString method, you should add them as you see fit. You are not required to implement the class attributes and methods exactly as specified here; feel free to add/remove attributes or methods to match how you think each class should be implemented. However, you must define each class keep the relationship as defined in the above class diagram, and must use the object oriented approach similar to what’s described in this document. Pay attention to the “shall” words in the document. You must make sure to implement the shalls defined in this document. 1. The Maze Class You shall define the Maze class. The maze is a 20 x 50 matrix represented by a 2-dimensional Entity array (The Entity Class is defined in the next paragraph). Walls in the maze are represented by ‘*’ and empty positions by blank spaces. The maze shall be read from a text file “Maze.txt” (The Maze.txt file is provided). A squirrel is able to move to empty spaces in the maze. ************************************************** ******************** ********************** ******************** ********************** ******************** ********************** *********** *********** *********** *********** * ** * ** * ** * ********************** ** * ********************** ** * ********************** ** * ********************** ** * ** * ** * ** ***** ************** ******** ************ ************* ***** ********* ************************************************** The Maze class defines the following attributes: 1. Max_Maze_Row: This class variable is a constant variable that defines the maximum number of rows in the maze (it should be set to 20 rows). 2. Max Maze Column: This class variable is a constant variable that defines the maximum number of columns in the maze (it should be set to 50 columns). 3. maze[][] : This class variable shall be defined as a 2-dimentional Entity array that contains the full maze and the entities. The Maze class implements the following methods: public static void create(String filename) This method reads the file passed to the method (e.g. Maze.txt) and initializes the 2-dimentional array with the maze content provided in the file. public static void display() This method displays the maze structure and the containing entities. public static boolean available(int row, int col) This method takes a row and a column and determines if the location is a blank space. If it is, it returns true; otherwise, it returns false. 2. Entity Class You shall define an abstract “Entity” class. Three types of entities exist in the Maze: Nut, Squirrel, and Wall. Each entity has three attributes: 1. symbol: This instance variable is a character symbol by which an entity is identified on the Maze. For example, a squirrel is represented by ‘@’. Each nut will be represented by the first character of its name (e.g. Almond will be represented by ‘A’). 2. row: This instance variable is the row position of the entity in the maze. 3. column: This instance variable is the column position of the entity in the maze. The abstract Entity class contains an abstract method: public void create(); The Entity class contains the following concrete method: public Entity put(int newRow, int newCol) This
Mar 02, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here