Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is to be coded in Java language Create a program that asks a user for their age and name and displays their age (as

This is to be coded in Java language
Create a program that asks a user for their age and name and displays their age (as a whole number) in a variety of animal years. Provide them a menu of 4 animal options to select from. One human year is equal to:
5.33 Chicken years
4.2 Duck years
8.89 Kangaroo years
2.29 Lion years
Specific requirements:
Create a Javadoc comment above your class. Include a description, your name, and date.
Use constants to hold the conversion rate for each animal year.
Use the Scanner class for this lab, not dialog boxes.
Ask for the users age first, and then their name.
Run your program 5 times (one for each animal and one where they dont provide a valid option) and paste the individual runs into one set of output.
(See example output below. You dont have to use the same names/ages as I do in my output.)
Example output:
Hi! How old are you? 27
What is your name? Ariana Grande
How would you like to see your age? In...
1. Chicken Years
2. Duck Years
3. Kangaroo Years
4. Lion Years
Enter your choice: 1
Ariana Grande, if you were a chicken you would be 143 years old!
Hi! How old are you? 44
What is your name? Benedict Cumberbatch
How would you like to see your age? In...
1. Chicken Years
2. Duck Years
3. Kangaroo Years
4. Lion Years
Enter your choice: 2
Benedict Cumberbatch, if you were a duck you would be 184 years
old!
Hi! How old are you? 51
What is your name? Jay-Z
How would you like to see your age? In...
1. Chicken Years
2. Duck Years
3. Kangaroo Years
4. Lion Years
Enter your choice: 3
Jay-Z, if you were a kangaroo you would be 453 years old!
Hi! How old are you? 36
What is your name? Trevor Noah
How would you like to see your age? In...
1. Chicken Years
2. Duck Years
3. Kangaroo Years
4. Lion Years
Enter your choice: 4
Trevor Noah, if you were a lion you would be 82 years old!
Hi! How old are you? 26
What is your name? Justin Bieber
How would you like to see your age? In...
1. Chicken Years
2. Duck Years
3. Kangaroo Years
4. Lion Years
Enter your choice: 9
Justin Bieber, seriously? That wasn't an option.

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

More Books

Students also viewed these Databases questions