Question: 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

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 month (a number 1-12) and day of the month (a number 1-13) they were born. Following that the program will display their zodiac sign.

Next, the program will ask the user their favorites color (the only choices should be: red, green and blue). Following that the program will display a fortune based on the chosen color. The three fortunes corresponding to the colors are:

Red: You will become a gold miner.

Green: You will become a forest ranger.

Blue: You will sing the blues.

Besides the main() method, your program must include a method that returns an integer (1-12) representing the zodiac sign (there are 12 zodiac signs). The method should accept as input parameters two integers (a month and day). The prototype for the method should be:

// Returns an integer 1-12 representing the zodiac sign for the given date int GetZodiac (int month, int day);

Your program should also contain a method to print the fortune given an integer (1-3) corresponding to the color chosen by the user. The prototype for the method should be:

// Prints the fortune (1-3)

void PrintFortune (int n); // n=1-3

For example, the output might look like:

What is your name? Elvis Welcome Elvis.

What month were you born on (1-12)? 3

What day of the month were you born on (1-13)? 18

Elvis, I see your sign is Pisces.

Choose your favorite color (1=red, 2=green, 3=blue): 3

You will sing the blues.

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!