Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Imagine we were creating a Textbased Adventure program and our Rooms in the assignment above could hold Items. We are not writing the complete game,

Imagine we were creating a Textbased Adventure program and our Rooms in the assignment above could hold Items. We are not writing the complete game, but lets write a program that will build the Item.txt file. Create a new project. Add a class called Item that stores information about an item that can be placed in a room. An item has a name, a description and the room number in which the item is initially is stored. LAMP, a brightly shining lamp, 3 is an example of data that an Item might contain. Using the UML model below, create the private data members and methods for constructing an item. Create an ItemFileWriter class with a static method to write the items from the given ArrayList to a text file.. The items text file will hold the item name, item description and the initial room that the item is to be loaded into, on seperate lines followed by a blank line. An example of the file that is to be constructed is attached. Construct a class with main() in it. Create an ArrayList of Items and get the item data from the user for as many items as the user wants to type in. After the user finishes inputting the items, write them to the Items text file using your ItemFileWriter. Next, have main() display how many items were written to the file. Be sure to fully document all classes. Item -itemName: String the name of the item -itemDescription: String the description of the item -initialRoom: int initial room the item will be put in +Item(name:String,descr:String,room:int) Constructor. This just sets the instance variables to the values of the parameters +getItemName(): String returns the name +getInitialRoom(): int returns initial room number +toString():String returns a string with the name and description

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago