NOTE: For this question, create all the assets for your solution in a package named quest Name your classes precisely as specified and follow the spec closely. We'll be using some automated tests to validate your code. Assume "good" data; no exception handling is expected or required. We're building an old-school text adventure game. For our first prototype, we need to keep track of Rooms and items for the Game. Create a class called Room. Room instances have names and some collection that allows it to manage/track the items in the room. The "items" are represented as Strings. Your Room class should have a public constructor that matches the following signature: public Room (String name, String [] items) The items argument may be null (meaning the room is empty). Rooms can also give us other information. We can query if a room is empty and/or if a room contains a certain item. Your Room should support the following operations: public boolean isEmpty() public boolean contains(String nameOf Item) We can compare Rooms for equality. In this case, we define rooms as "equal" if the names are the same. Be sure to provide a .equals() override. (Note: You can also provide a hashCode override, but it is not required for this question and no penalty assessed if you do not provide one) public boolean equals(Object other)
NOTE: For this question, create all the assets for your solution in a package named quest Name your classes precisely as specified and follow the spec closely. We'll be using some automated tests to validate your code. Assume "good" data; no exception handling is expected or required. We're building an old-school text adventure game. For our first prototype, we need to keep track of Rooms and items for the Game. Create a class called Room. Room instances have names and some collection that allows it to manage/track the items in the room. The "items" are represented as Strings. Your Room class should have a public constructor that matches the following signature: public Room (String name, String [] items) The items argument may be null (meaning the room is empty). Rooms can also give us other information. We can query if a room is empty and/or if a room contains a certain item. Your Room should support the following operations: public boolean isEmpty() public boolean contains(String nameOf Item) We can compare Rooms for equality. In this case, we define rooms as "equal" if the names are the same. Be sure to provide a .equals() override. (Note: You can also provide a hashCode override, but it is not required for this question and no penalty assessed if you do not provide one) public boolean equals(Object other)
Chapter18: Maintaining And Querying A Database
Section: Chapter Questions
Problem 11QY
Related questions
Question
question in java please!
![NOTE: For this question, create all the assets for your solution in a package
named quest
Name your classes precisely as specified and follow the spec closely. We'll be
using some automated tests to validate your code. Assume "good" data; no
exception handling is expected or required.
We're building an old-school text adventure game. For our first prototype, we
need to keep track of Rooms and items for the Game.
Create a class called Room. Room instances have names and some collection
that allows it to manage/track the items in the room. The "items" are
represented as Strings. Your Room class should have a public constructor that
matches the following signature:
public Room (String name, String [] items)
The items argument may be null (meaning the room is empty). Rooms can also
give us other information. We can query if a room is empty and/or if a room
contains a certain item. Your Room should support the following operations:
public boolean isEmpty()
public boolean contains (String nameOf Item)
We can compare Rooms for equality. In this case, we define rooms as "equal"
if the names are the same. Be sure to provide a .equals() override. (Note: You
can also provide a hashCode override, but it is not required for this question and
no penalty assessed if you do not provide one)
public boolean equals(Object other)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7946b8ad-32cf-4c0f-ab08-4fb9e7e93698%2Fdd5396bf-1a37-4a4a-84e7-7fc6e24a4dc3%2F06nei2kt_processed.png&w=3840&q=75)
Transcribed Image Text:NOTE: For this question, create all the assets for your solution in a package
named quest
Name your classes precisely as specified and follow the spec closely. We'll be
using some automated tests to validate your code. Assume "good" data; no
exception handling is expected or required.
We're building an old-school text adventure game. For our first prototype, we
need to keep track of Rooms and items for the Game.
Create a class called Room. Room instances have names and some collection
that allows it to manage/track the items in the room. The "items" are
represented as Strings. Your Room class should have a public constructor that
matches the following signature:
public Room (String name, String [] items)
The items argument may be null (meaning the room is empty). Rooms can also
give us other information. We can query if a room is empty and/or if a room
contains a certain item. Your Room should support the following operations:
public boolean isEmpty()
public boolean contains (String nameOf Item)
We can compare Rooms for equality. In this case, we define rooms as "equal"
if the names are the same. Be sure to provide a .equals() override. (Note: You
can also provide a hashCode override, but it is not required for this question and
no penalty assessed if you do not provide one)
public boolean equals(Object other)
![In addition to the Room class, you need to provide a Game class. Game
instances manage collections of Rooms.
Provide a public constructor to create Game instances. Its signature looks like
this:
public Game(List<Room> rooms)
Your Game class should provide two basic methods for filtering and gathering
sub-collections of Rooms based on a given criteria. Here are the signatures
for the methods:
public List<Room> getEmptyRooms ()
public List<Room> getRoomsWith(String item)
getEmptyRooms() returns a List of Rooms from the Game that are empty (e.g.
rooms that answer true when their isEmpty() method is called)
getRoomsWith() returns a List of Rooms from the Game that contain the item
passed in as the parameter](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7946b8ad-32cf-4c0f-ab08-4fb9e7e93698%2Fdd5396bf-1a37-4a4a-84e7-7fc6e24a4dc3%2F4oc81tk_processed.png&w=3840&q=75)
Transcribed Image Text:In addition to the Room class, you need to provide a Game class. Game
instances manage collections of Rooms.
Provide a public constructor to create Game instances. Its signature looks like
this:
public Game(List<Room> rooms)
Your Game class should provide two basic methods for filtering and gathering
sub-collections of Rooms based on a given criteria. Here are the signatures
for the methods:
public List<Room> getEmptyRooms ()
public List<Room> getRoomsWith(String item)
getEmptyRooms() returns a List of Rooms from the Game that are empty (e.g.
rooms that answer true when their isEmpty() method is called)
getRoomsWith() returns a List of Rooms from the Game that contain the item
passed in as the parameter
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you