Written Exercise 5 In the previous exercise you created thegetRoomExitsAndDescriptionmethod that prints adescription of the current roomand alist of the exits.This code is contained in the Game class....


Written Exercise 5


In the previous exercise you created thegetRoomExitsAndDescriptionmethod that prints adescription of the current roomand alist of the exits.This code is contained in the Game class. This is not a good design. Explain why.


Programming Exercise 2


Make a copy of theFirstNameLastName-PE1project and rename the copy toFirstNameLastName-PE2.For example, mine would be AlexHendry-PE2. Your folder should now look like:


In the FirstNameLastName-PE2 project:




  • Refactor the code that generates thelist of the exitsinto a method namedgetExitStringin theRoomclass. This method shouldreturn a Stringlisting the exits from the room. For example, if the room has exits to the north and west, this method should return a String containing: "north west".




  • Add a method calledgetLongDescriptionto the Room class that returns a String containing thedescription of the current roomand alist of the exitsof a room (hint: call thegetExitStringmethod you just created





May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here