This program will ask a user to enter their favorite color. Your program will tell the user what their “spirit animal” is based on the color entered. (Or you can do something similar but different – like online quizzes that tell you what kind of potato you are.) You will create a static method called getAnimal that takes in a single String and returns a String. In this method, you will write the code that will determine which animal gets returned. You may choose the possible colors and animals (or you may choose something else ridiculous for this program) but you must have at least 4 options for the user. For example, if they enter “red”, you might return “Tiger”. Make sure to include a response for incorrect inputs. In the main method you will give the program explanation, ask for input (favorite color), capture the input, call the getAnimal method (passing in the user’s input), and print the result. No try/catch blocks or loops are necessary. The static method should contain no print statements or requests for user input. It’s only task is to determine which animal string should be returned based on the user’s number.   Example:   What is your favorite color? (Select from red, green, blue, yellow, or black) I will tell you what your animal is.   >>>red   Tiger   ****************************************************************   What is your favorite color? (Select from red, green, blue, yellow, or black) I will tell you what your animal is.   >>>YELLOW   Does not compute.     in java

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  1. This program will ask a user to enter their favorite color. Your program will tell the user what their “spirit animal” is based on the color entered. (Or you can do something similar but different – like online quizzes that tell you what kind of potato you are.)

  2. You will create a static method called getAnimal that takes in a single String and returns a String. In this method, you will write the code that will determine which animal gets returned. You may choose the possible colors and animals (or you may choose something else ridiculous for this program) but you must have at least 4 options for the user. For example, if they enter “red”, you might return “Tiger”. Make sure to include a response for incorrect inputs.

  3. In the main method you will give the program explanation, ask for input (favorite color), capture the input, call the getAnimal method (passing in the user’s input), and print the result.

  4. No try/catch blocks or loops are necessary.

  5. The static method should contain no print statements or requests for user input. It’s only task is to determine which animal string should be returned based on the user’s number.

 

Example:

 

What is your favorite color? (Select from red, green, blue, yellow, or black) I will tell you what your animal is.

 

>>>red

 

Tiger

 

****************************************************************

 

What is your favorite color? (Select from red, green, blue, yellow, or black) I will tell you what your animal is.

 

>>>YELLOW

 

Does not compute.

 

 

in java

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Class
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.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education