Name your program Giveaway.java, and it should work as follows.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

USE JAVA

Question/Prompt is in the picture attached, and use example outputs as a guide. 

second picture is the inventory used in prompt

Please be precise.

 

EXAMPLE OUTPUT 1

Welcome to the 1331 Giveaway!


Would you like to take an item? [Y]es, [N]o, or [E]xit
Y


|x|x|StuffedPython|x|CSalt|
|hAIrspray|x|x|x|x|
|x|x|x|JavaBeans|x|
|x|RustedMetal|SwiftShoes|x|x|
|FuRniture|x|x|GroovyGear|RadiantRuby|


What item are you interested in taking?
0 5


Location does not exist.


What item are you interested in taking?
0 4


You successfully took the CSalt!


|x|x|StuffedPython|x|x|
|hAIrspray|x|x|x|x|
|x|x|x|JavaBeans|x|
|x|RustedMetal|SwiftShoes|x|x|
|FuRniture|x|x|GroovyGear|RadiantRuby|


Would you like to take an item? [Y]es, [N]o, or [E]xit
Z


Please input ‘Y’, ‘N’, or ‘E’.


Would you like to take an item? [Y]es, [N]o, or [E]xit
E
Have a good day!

 

EXAMPLE OUTPUT 2

Welcome to the 1331 Giveaway!


Would you like to take an item? [Y]es, [N]o, or [E]xit
Y


|x|x|StuffedPython|x|CSalt|
|hAIrspray|x|x|x|x|
|x|x|x|JavaBeans|x|
|x|RustedMetal|SwiftShoes|x|x|
|FuRniture|x|x|GroovyGear|RadiantRuby|


What item are you interested in taking?
10 5


Location does not exist.


What item are you interested in taking?
0 0


There is no item in this location.


What item are you interested in taking?
1 0


You successfully took the hAIrspray!


|x|x|StuffedPython|x|CSalt|
|x|x|x|x|x|
|x|x|x|JavaBeans|x|
|x|RustedMetal|SwiftShoes|x|x|
|FuRniture|x|x|GroovyGear|RadiantRuby|


Would you like to take an item? [Y]es, [N]o, or [E]xit
N
Next person in line!


Would you like to take an item? [Y]es, [N]o, or [E]xit
E
Have a good day!

 

2D Array Chart
The following String values must be stored within a 2D array called inventory. Create the 2D array with
the values from the following chart. Each cell visually represents a space for an item. X represents that
no item is currently at the location. For these locations, use "x" (lowercase) to represent empty spaces.
Provided 2D array
StuffedPython
CSalt
hAIrspray
JavaBeans
RustedMetal
SwiftShoes
FuRniture
GroovyGear
RadiantRuby
Transcribed Image Text:2D Array Chart The following String values must be stored within a 2D array called inventory. Create the 2D array with the values from the following chart. Each cell visually represents a space for an item. X represents that no item is currently at the location. For these locations, use "x" (lowercase) to represent empty spaces. Provided 2D array StuffedPython CSalt hAIrspray JavaBeans RustedMetal SwiftShoes FuRniture GroovyGear RadiantRuby
Name your program Giveaway.java, and it should work as follows.
Acquiring items:
Welcome the user and print: "Welcome to the 1331 Giveaway!"
Prompt and ask the user if they want to take an item: "Would you like to take an item? [Y]es,
[N]o, or [E]xit"
If the user inputs 'N' (case sensitive), print: "Next person in line!" and prompt the next
user the same prompt above. See example.
If the user inputs 'E' (case sensitive), print: "Have a good day!" and end the program
gracefully (i.e., the program ends normally without any exceptions thrown)
If the user inputs 'Y', print the current state of the giveaway 2D array and then proceed
to print: "What item are you interested in taking?"
At this point, the user should enter coordinates separated by a space where the
row should be entered first followed by the column to the item's location.
See the next section titled “Item selection" for more details.
Otherwise, if the user inputs a character outside of 'Y', 'N’, or 'E', loop until the user
inputs a proper character by prompting, "Please input 'Y', 'N’, or 'E'." followed by the
prompt "Would you like to take an item? [Y]es, [N]o, or [E]xit"
The giveaway program should be in a loop such that different users will be able to take an item
until either 'E' is inputted or there are no more items left.
Once there are no items left, instead of printing the regular prompt for Y/N/E, print: "Sorry, we
have no more items!"
The program should end gracefully afterwards.
Note: in this case, “Have a good day!" should not be printed
Item selection:
If the user input has an invalid row or invalid column, print: "Location does not exist."
Re-prompt the user "What item are you interested in taking?"
If the location inputted is empty (no item in it), print: "There is no item in this location."
Re-prompt the user "What item are you interested in taking?"
If the location inputted has an item, print: "You successfully took the [Name of the item]!"
Please be aware that we are only testing numeric input of the location in the correct format.
0 3 (correct format)
o 0,3 (incorrect format)
03 (incorrect format)
After an item has been taken, the grid containing the item should be replaced by “x". Print out
the new grid.
The program should loop back to the previous prompt, "Would you like to take an item?
[Y]es, [N]o, or [E]xit"
Transcribed Image Text:Name your program Giveaway.java, and it should work as follows. Acquiring items: Welcome the user and print: "Welcome to the 1331 Giveaway!" Prompt and ask the user if they want to take an item: "Would you like to take an item? [Y]es, [N]o, or [E]xit" If the user inputs 'N' (case sensitive), print: "Next person in line!" and prompt the next user the same prompt above. See example. If the user inputs 'E' (case sensitive), print: "Have a good day!" and end the program gracefully (i.e., the program ends normally without any exceptions thrown) If the user inputs 'Y', print the current state of the giveaway 2D array and then proceed to print: "What item are you interested in taking?" At this point, the user should enter coordinates separated by a space where the row should be entered first followed by the column to the item's location. See the next section titled “Item selection" for more details. Otherwise, if the user inputs a character outside of 'Y', 'N’, or 'E', loop until the user inputs a proper character by prompting, "Please input 'Y', 'N’, or 'E'." followed by the prompt "Would you like to take an item? [Y]es, [N]o, or [E]xit" The giveaway program should be in a loop such that different users will be able to take an item until either 'E' is inputted or there are no more items left. Once there are no items left, instead of printing the regular prompt for Y/N/E, print: "Sorry, we have no more items!" The program should end gracefully afterwards. Note: in this case, “Have a good day!" should not be printed Item selection: If the user input has an invalid row or invalid column, print: "Location does not exist." Re-prompt the user "What item are you interested in taking?" If the location inputted is empty (no item in it), print: "There is no item in this location." Re-prompt the user "What item are you interested in taking?" If the location inputted has an item, print: "You successfully took the [Name of the item]!" Please be aware that we are only testing numeric input of the location in the correct format. 0 3 (correct format) o 0,3 (incorrect format) 03 (incorrect format) After an item has been taken, the grid containing the item should be replaced by “x". Print out the new grid. The program should loop back to the previous prompt, "Would you like to take an item? [Y]es, [N]o, or [E]xit"
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY