Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a file Animal Shelter.java that allows people to adopt pets. We will provide you with an initial array containing pets that are available to

image text in transcribed
image text in transcribed
Create a file Animal Shelter.java that allows people to adopt pets. We will provide you with an initial array containing pets that are available to be adopted at the shelter (five by five grid). Create a single Java class called AnimalShelter with a main method header. Do NOT create a Scanner object outside of the main method. 2D Array Chart The following values must be stored within a 2D array called shelter. Each cell should visually represent a pen. Tomas Leedan Lio Stefanie Rhitvic X Nepun Andhru X Avenash X Dustan . . . Name your program Animalshelter.java, and it should work as follows. Adopting a pet: Welcome the user and print: "Welcome to the Animal Shelter!" Prompt and ask the userif they want to adopt a pet. wyll for yes, "N" for no, and "E" for exit. This will be case sensitive. The Animal Shelter should be in a loop such that different users will be able to adopt a pet until either "E" is inputted or there are no more pets left. Once there are no pets left, print: "Sorry, we have no more pets!" If the user inputs "Y", print the current state of the shelter 2D array and then proceed to print: "What pet are you interested in adopting?" 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 pet's location. If the user inputs "N", print: "Next person in line!" If the user inputs "E", print: "We hope you come again!" . . . . . . Asking the user what pet they want to adopt: If the user input has an invalid row or invalid column, print:"Location does not exist." o Re-prompt the user "What pet are you interested in adopting?". If the location inputted is empty (no petin it), print: "There is no pet in this location." o Re-prompt the user "What pet are you interested in adopting?". If the location inputted has a pet print."[Name of the pet] has been successfully adopted!" Please be aware that we are only testing numeric input of the location in the correct format. o 03 (correct format) O 0,3 (incorrect format) o 03 (incorrect format) After a pet has been adopted, the grid containing the pet should be replaced by, and print out the new shelter. After the pet has been successfully adopted, the program should loop back to the previous prompt, "Would you like to adopt a pet? [Yes, [N]o, or [E]xit. Example Output#1 - User input is bolded. (Your program should look exactly like this with the exact spacings and linest if there is any deviation, you will lose points) Welcome to the Animal Shelter! Would you like to adopt a pet? [Yes, [N]o, or [E]xit Y 1x|x|Stefanie x Tomas | Leedanx1x1x1x1 |xIxIx|Andhruix] |x|lio Rhitvic|xx| Nepun xlx Avenash |Dustan| What pet are you interested in adopting? 05 Location does not exist. What pet are you interested in adopting? 04 Tomas has been successfully adopted! 1x1x Stefanie xx

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

2. How will the team select a leader?

Answered: 1 week ago