7. Design Patterns [Points: 30] A downloadable standalone game software needs to be created with an...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. Design Patterns [Points: 30] A downloadable standalone game software needs to be created with an MVC architectural pattern where game engine is the controller (GameController); the scenes are the views GamePlay View, GameCombat View, and GameConfigView; the game & gamer info is the model GameModel, which is essentially an entity class. Also, we need the controller, which is the game engine to be built with Singleton design pattern. The views are created from the abstract base class Game View. The GameModel will have the following attributes: playerName: String, score: int, level: int, and sceneID: int. Be advised that it is just an entity class. The GamePlay View, GameCombatView, and GameConfigView will be subclasses created from GameView abstract class. These views will display information about the player and the related scene identified by scenelD. You can assume about which sceneID (such as PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW) will display what additional info about the scene. The display can be a simple string with all relevant info. You should create a enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. GameController class will be a singleton. You will have to implement the controller class. Follow the MVC design pattern implementation shown in the example in Lecture 14 for the model, its controller, and the corresponding view. Use provided Game View abstract class as the base view and extend this to create GamePlayView, GameCombat View, and GameConfigView concrete classes. Create the GameModel class as the model. You will also need a Driver class to create all the components of the MVC architecture and make 3 calls to the controller to edit model and show view. Implement the followings: based on this problem statement: i. 11. 111. IV. V. vi. Implement the GameModel with the information provided earlier. [2.5] Implement the enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. [2.3] Implement the Game View abstract base class. [2.5] Implement the concrete observer classes GamePlay View, GameCombat View, and the GameConfigView from the base class GameView. Make sure to show appropriate view information based on the view type along with the model info. [6] Implement GameController Class as Singleton and as the controller for MVC in Java (make sure to provide all controller related methods as shown in Lecture 14). The GameController class will have only one parameterized constructor which will take GameModel as the parameter. [4.5+ 4.5=9pts] Complete the implementation of the Driver class. Here the static method "getFromDB" (provided below) in the Driver class as the mock connection with the Database to retrieve GameModel info. [7.5] public class Driver { public static void main(String[] args) { GameModel model1 = getFromDB("StarCommander",1000, 5, 10); //create 2 more models with different data //Instantiate the three views with three view classes // Get or create Game Controller instance with one model and one view //display the view using the controller //modify the model and view for the controller with the 2nd model and 2nd view //display the view using the controller // just modify the model for the controller //display the view } public static GameModel getFromDB(String name, int score, int level, int sceneID) { return (new GameModel(name, score, level, sceneID)); } 7. Design Patterns [Points: 30] A downloadable standalone game software needs to be created with an MVC architectural pattern where game engine is the controller (GameController); the scenes are the views GamePlay View, GameCombat View, and GameConfigView; the game & gamer info is the model GameModel, which is essentially an entity class. Also, we need the controller, which is the game engine to be built with Singleton design pattern. The views are created from the abstract base class Game View. The GameModel will have the following attributes: playerName: String, score: int, level: int, and sceneID: int. Be advised that it is just an entity class. The GamePlay View, GameCombatView, and GameConfigView will be subclasses created from GameView abstract class. These views will display information about the player and the related scene identified by scenelD. You can assume about which sceneID (such as PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW) will display what additional info about the scene. The display can be a simple string with all relevant info. You should create a enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. GameController class will be a singleton. You will have to implement the controller class. Follow the MVC design pattern implementation shown in the example in Lecture 14 for the model, its controller, and the corresponding view. Use provided Game View abstract class as the base view and extend this to create GamePlayView, GameCombat View, and GameConfigView concrete classes. Create the GameModel class as the model. You will also need a Driver class to create all the components of the MVC architecture and make 3 calls to the controller to edit model and show view. Implement the followings: based on this problem statement: i. 11. 111. IV. V. vi. Implement the GameModel with the information provided earlier. [2.5] Implement the enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. [2.3] Implement the Game View abstract base class. [2.5] Implement the concrete observer classes GamePlay View, GameCombat View, and the GameConfigView from the base class GameView. Make sure to show appropriate view information based on the view type along with the model info. [6] Implement GameController Class as Singleton and as the controller for MVC in Java (make sure to provide all controller related methods as shown in Lecture 14). The GameController class will have only one parameterized constructor which will take GameModel as the parameter. [4.5+ 4.5=9pts] Complete the implementation of the Driver class. Here the static method "getFromDB" (provided below) in the Driver class as the mock connection with the Database to retrieve GameModel info. [7.5] public class Driver { public static void main(String[] args) { GameModel model1 = getFromDB("StarCommander",1000, 5, 10); //create 2 more models with different data //Instantiate the three views with three view classes // Get or create Game Controller instance with one model and one view //display the view using the controller //modify the model and view for the controller with the 2nd model and 2nd view //display the view using the controller // just modify the model for the controller //display the view } public static GameModel getFromDB(String name, int score, int level, int sceneID) { return (new GameModel(name, score, level, sceneID)); }
Expert Answer:
Answer rating: 100% (QA)
Below is the implementation for the described problem statement Ill provide code snippets for each part Implement the GameModel ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
2. The long-term loan from World Bank had been taken out on 1 April 2018 to fund the company. According to the loan agreement, five annual installments of R36 000 are to be paid each year commencing...
-
On January 1, 2013, Ponasis Corporation issued $2.5-million, 10-year bonds. The bonds pay semi-annual interest on July 1 and January 1, and Ponasis has a December 31 year end. Presented below is a...
-
Human DNA contains 20% C on a molar basis. What are the mole percents of A, G, and T?
-
How is art used in support of social structure and power?
-
Given the following business rules, construct an ER diagram so each rule is captured for the database. Presume each rule is to be treated individually. Construct an ER diagram for each rule. a. A...
-
Oriole Corporation manufactures safes-large mobile safes, and large walk-in stationary bank safes. As part of its annual budgeting process, Oriole is analyzing the profitability of its two products....
-
Using object-oriented inheritance, create an inheritance hierarchy with at least five classes of different employee categorization to simulate the payment of a bonus as well as annual increment in an...
-
You were asked to assist with improving job satisfaction levels in a mid-size company based in Singapore. a) Are attitudes easy to change? Why? b) Briefly define and describe the concept of job...
-
What strategies could be used to revamp the mill risk assessment process ? How do we incorporate Artificial intelligence techniques to enhance the procurement process ? This is a question from...
-
Many feel that the world's biggest retailer Walmart views Amazon as their biggest competitor/threat. In reading the Gartner Top 25 information on Amazon and doing some additional research on Amazon's...
-
As a manager, what are some ways you help increase job satisfaction in your employees? What are the organizational consequences when there are high or low levels of job satisfaction?
-
Q1- What is habeas corpus? GIve and example Q2- What are Torts? GIve and example Q3. What is Section 1983? GIve and example Q4- Explain the process for Prison officials from getting summon to court...
-
The following items are related to income tax expenses. Determine the specific eight or nine-digit codification citation (XXX-XX-XX-XX) for each of the following items. Please enter only the ASC...
-
(a) Explain why the concentration of dissolved oxygen in freshwater is an important indicator of the quality of the water. (b) How is the solubility of oxygen in water affected by increasing...
-
Frederick (Freddy) Freeweights (age 42) owns and operates a health club called ''Treadmills West.'' The business is located at 4321 Arnold Street, Alpine, CA 91901. Freddy had the following income...
-
Professor Patricia (Patty) Pate is retired from the PalmSprings Culinary Arts Academy (PSCAA). She is a single taxpayer and is 68 years old. Patty lives at 98 Colander Street, Henderson, NV 89052....
-
Larry Gaines, age 42, sells his personal residence on November 12, 2012, for $144,000. He lived in the house for 7 years. The expenses of the sale are $10,500, and he has made capital improvements of...
-
The properties of water and steam become identical at (a) 0.1 bar (b) 1 bar (c) \(100 \mathrm{bar}\) (d) 212.2 bar.
-
Steam from an engine exhaust at 1.25 bar flows steadily through an electric calorimeter and comes out at \(1 \mathrm{bar}, 130^{\circ} \mathrm{C}\). The calorimeter has two \(\mathrm{kW}\) heaters...
-
In thermodynamic analysis, a pure substance is that which (a) Consists of only a single chemical species (b) has no dissolved impurities (c) may have a number of chemical species but the composition...
Study smarter with the SolutionInn App