Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Java Program Fortune Teller Program Begin Asking User Enter Name Following Program D Q35624450

Write a Java program for a fortune teller.

The program should begin by asking the user to enter their name.Following that the program will display a greeting.

Next, the program will ask the user to enter the year (a 4-digitnumber) they were born. Following that the program will displaytheir Chinese Zodiac sign (one of 12 animals). You can findinformation about the Chinese Zodiac on the Internet and in yourtextbook.

Next, the program will ask the user their favorites food (theonly choices should be: fish, chicken, steak, shrimp). Followingthat the program will display a fortune based on the chosen foodand after that a goodbye message. The three fortunes correspondingto the foods are:

Fish: You will become a computer programmer.

Chicken: You will become a famous musician.

Steak: You will play professional sports.

Shrimp: You will become and astronaut and travel to themoon.

Besides the main() method, your program must include a methodthat returns an integer (0-11) representing the zodiac sign (thereare 12 zodiac signs). The method should accept as input parametersone integer (a year). The prototype for the method should be:

Your program should also contain a method to print the fortunegiven an integer (1-4) corresponding to the food chosen by theuser. The prototype for the method should be:

For example, the output might look like:

What is your name? Steve

Welcome Steve.

What year were you born? 1998

Steve, that was the year of the Rat.

Leave a Reply

Your email address will not be published. Required fields are marked *