Question: Need help on this. Java 1- introduction. Will leave great rating. Code a while loop with if/else structures that determine an anniversary gift based on

Need help on this. Java 1- introduction. Will leave great rating.

Code a while loop with if/else structures that determine an anniversary gift based on the number of years married.

i.Declare a loop-control variable initialized to Y.

ii.Declare a String variable that stores the gift.

iii.Declare an integer variable that stores the choice for the anniversary year.

iv.Code the while where you test the loop-control variable to Y using Character.toUpperCase().

Have the user choose from the prompt:

ANNIVERSARY YEAR

1.50

2.55

3.60

4.None of the above.

Select the anniversary year:

Based on the yearChoice print The anniversary gift is xxxxxxxxxx. where the xs represent the anniversary gift.

For yearChoice 1 or 50th anniversary, the gift is gold.

yearChoice 2 the gift is emerald.

yearChoice 3 the gift is diamond.

yearChoice 4 display this statement: go to www.bernardine.com/jewelry-anniv.htm#traditional for more gift choices.

Prompt to re-enter the loop or exit.

Refer to sample output below.

v.Assume the input variable for the Scanner class is already declared.

i.****SAMPLE OUTPUT*****

ANNIVERSARY YEAR

1. 50

2. 55

3. 60

4. None of the above.

Select the anniversary year: 1

The anniversary gift is gold.

Search for another anniversary gift? Enter 'Y' or 'N': y

ANNIVERSARY YEAR

1. 50

2. 55

3. 60

4. None of the above.

Select the anniversary year: 2

The anniversary gift is emerald.

Search for another anniversary gift? Enter 'Y' or 'N': y

ANNIVERSARY YEAR

1. 50

2. 55

3. 60

4. None of the above.

Select the anniversary year: 3

The anniversary gift is diamond.

Search for another anniversary gift? Enter 'Y' or 'N': y

ANNIVERSARY YEAR

1. 50

2. 55

3. 60

4. None of the above.

Select the anniversary year: 4

The anniversary gift is go to www.bernardine.com/jewelry-anniv.htm#traditional for more gift choices.

Search for another anniversary gift? Enter 'Y' or 'N': n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!