Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a problem with a java assignment. The assignment asked me to create a method within a zuul game that allow the player to

I have a problem with a java assignment.

The assignment asked me to create a method within a zuul game that allow the player to drop a specific item in the room he/she is currently in

the constructor:

image text in transcribed

the current take method:

image text in transcribed

the item class :

image text in transcribed

and the command class:

image text in transcribed

thank you

/** this allows player to pick an item, * will print out pick what if no commandword is detected private void take (Command command) String itemNamet command.getSecondWord(); //Item items if (itemNamet != "chair" llitemNamet != "desk" llitemNamet != "computer" llitemNamet !- "midte System.out.println ("invalid object, please select again"): else hungry.add(itemNamet); 2 4 25 26 27 28 29 30 31 32 public class Command private String commandword; private String secondword; oa er *Create a command object. First and second word must be supplied, but either one (or both) can be null. @param firstWord The first word of the command. Null if the command @param secondword The second word of the command 35 36 37 38 39 40 41 was not recognised sh public Command (String firstWord, String secondWord) commandword-firstWord; this.secondWord-secondword; ec 43 45 46 47 er Return the command word (the first word) of this command . If the command was not understood, the result is null oa 49 @return The command word, or null if not understood 51 52 53 public String getCommandword () return commandord; 56 57 58 59 60 *Returns the second word of the command. Returns null if there was no * second word. @return The second word of this command, or null if only one word public String getsecondword () 63 64 65 return secondword; 67 length : 2,423 lines: 88 Ln 1 Col:1 Sel:010 Unix (LF) ava source file

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_2

Step: 3

blur-text-image_3

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

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions