Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA LANGUAGE Generation The approximate ranges of the generations in Western culture are defined as follows: 1) The Lost Generation: 1883 1900 2) GI Generation:

JAVA LANGUAGE

Generation

The approximate ranges of the generations in Western culture are defined as follows:

1) The Lost Generation: 1883 1900

2) GI Generation: 1901 1924

3) Silent Generation: 1925 1945

4) Baby Boomers: 1946 1964

5) Generation X: 1965 1984

6) Millennial: 1985 2004

7) Generation Z: 2005 present

Write a program that asks the user to enter a birth year. The program should then indicate which generation a person of that year belongs/would have belonged to.

You will need:

A scanner object for input

Input validation: Make sure the year entered is within the range of 1883 2017. (Use a while loop for best results)

A variable to store the year entered

An if else if statement to select the appropriate generation

A sample of the output is shown below:

Enter a year: 206 Sorry, that year is not within the valid range. Re-enter the year: 2006 You are part of Generation Z.

Chinese Zodiac

Write a program that asks the user to enter a year. The program should then indicate the type of year it is based on the Chinese Zodiac.

The order of the Chinese Zodiac shown below is based on a 12-year cycle. The first zodiac corresponds to years divisible by 12 (remainder 0), the second year corresponds to years that a produce a remainder of 1 and so on. For instance, 2017 is the year of the rooster because 2017 divided by 12 produces a remainder of 1.

The years are as follows:

Monkey

Rooster

Dog

Pig

Rat

Ox

Tiger

Rabbit

Dragon

Snake

Horse

Sheep

You will need:

A scanner object for input

Input validation: Make sure the year entered is positive! (Use a while loop for this part.)

A variable to store the year entered

A switch statement to select the appropriate zodiac sign

A sample of the output is shown below:

Enter a year: -89 Enter anno domini (AD) years please! Re-enter the year: 1989 The year 1989 is the year of the snake

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

=+country competitive advantages? Why? Support your point of view.

Answered: 1 week ago

Question

=+from: a) a MNEs perspective? and b) the HRM managers perspective?

Answered: 1 week ago