Java Crash Course Lab Exercises : Object Oriented Design and Swing 1 Object Oriented Design Overview The goal of this exercise is to design the program structure for a text-based adventure game system. These types of game were very popular before computers became powerful enough to do interactive graphics, and they still exist in the form of Multi User Dungeons (MUDs). Adventure games involve moving between rooms/areas, collecting items, solving puzzles, etc. A textual description of your current location is printed onto the screen, for example: You are in a sunny glade. There is a path to the west. You can see a treasure_chest, a pointy_stick and an old_man You interact by typing instructions such as “go west” or “use gold_key on treasure_chest”. Game Details A complete game system would: 1. Load game levels from file, each level consists of a number of rooms which are connected in a specified manner (the file format is specified below). 2. Allow the adventurer to move between rooms (using the command “go north/east/south/west”), 3. Allow the adventurer to pickup/drop objects and list the objects they currently hold. 4. Allow the adventurer to use objects to solve puzzles. 5. Allow levels to contain NPCs (non-player characters) which the adventurer can interact with. Task Outline the classes and interfaces you would create and how they relate to each other (in terms of inheritance and usage). 2 Swing This exercise will introduce you to Swing, and further encourage your use of the Java API documentation as a source of information. 1 For a previous exercise we created a text based program for creating and sorting a list of shapes. This exercise is to produce a GUI version. You should be able to use the Shape, Rectangle and Circle classes from your previous assignment as well as any support classes you created to perform sorting operations. Interface Requirements: • The program should be run by typing java ShapeGUI. • Your program should present an interface that contains a Swing component listing the Shape objects that have been created. • The program should provide a means to perform the following operations: 1. Create a new rectangle/circle. 2. Delete a shape. 3. Sort shapes by position/area. 4. Exit • You should make use of at least 4 different Swing GUI components in your program - it is up to you to decide which ones to use, and you should investigate the possible choices by referring to the API documentation. Please note that the interface requirements do not require that you draw the shapes. 2