1. Import the scanner class from the java.util package. 2. Define a public class named Zodiacsign....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Import the scanner class from the java.util package. 2. Define a public class named Zodiacsign. 3. Define the main method within the ZodiacSign class. 4. Create a new instance of the scanner class to read user input. 5. Prompt the user to enter their birth month (1-12) and store the value in the month variable. 6. Prompt the user to enter their birth day (1-31) and store the value in the day variable. 7. Close the scanner to release system resources. 8. Create an empty string variable zodiac sign to store the calculated zodiac sign. 9. Use a switch statement to determine the zodiac sign based on the user's input month. 10. For each case (month), use nested if-else statements to further determine the zodiac sign based on the day of birth (refer to the Astrological sign table below). 11. Set the appropriate Unicode character for the zodiac sign based on the determined sign and assign it to the zodiacsign variable. 12. Break out of the switch statement after each case is evaluated. 13. Use a default case in the switch statement to handle an invalid month input. 14. Finally, display the calculated zodiac sign using the system.out.println statement. Here is a comprehensive list of astrological signs along with their corresponding Unicode symbols and time periods: Zodiac Sign Aquarius Pisces Aries Taurus Gemini Cancer Leo mg Virgo Libra mScorpio Sagittarius Capricorn String sign Symbol U+2652 = U+2653 U+2649 U+264A U+2648 Mar 21 - Apr 19 Apr 20 - May 20 May 21 - Jun 20 Jun 21 - Jul 22 U+264B U+264C U+264D U+264E U+264F U+2650 U+2651 Period Jan 20 - Feb 18 "\u264C"; . Feb 19 Mar 20 Jul 23 - Aug 22 Aug 23 - Sep 22 Sep 23 Oct 22 Oct 23 - Nov 21 Note: To print or store a zodiac sign in your program, use the \u escape sequence followed by the four hexadecimal digits representing the Unicode code point of that specific character. For instance, to print the Gemini sign, you can use System.out.print("\u264A"); . If you want to store the Leo sign in a variable, you can do so by assigning it like this: Nov 22 - Dec 21 Dec 22 - Jan 19 Below is a sample output of what your code should display when it is executed: Enter the month of birth (1-12): 6 Enter the day of birth (1-31): 22 Your zodiac sign is: Cancer 1. Import the scanner class from the java.util package. 2. Define a public class named Zodiacsign. 3. Define the main method within the ZodiacSign class. 4. Create a new instance of the scanner class to read user input. 5. Prompt the user to enter their birth month (1-12) and store the value in the month variable. 6. Prompt the user to enter their birth day (1-31) and store the value in the day variable. 7. Close the scanner to release system resources. 8. Create an empty string variable zodiac sign to store the calculated zodiac sign. 9. Use a switch statement to determine the zodiac sign based on the user's input month. 10. For each case (month), use nested if-else statements to further determine the zodiac sign based on the day of birth (refer to the Astrological sign table below). 11. Set the appropriate Unicode character for the zodiac sign based on the determined sign and assign it to the zodiacsign variable. 12. Break out of the switch statement after each case is evaluated. 13. Use a default case in the switch statement to handle an invalid month input. 14. Finally, display the calculated zodiac sign using the system.out.println statement. Here is a comprehensive list of astrological signs along with their corresponding Unicode symbols and time periods: Zodiac Sign Aquarius Pisces Aries Taurus Gemini Cancer Leo mg Virgo Libra mScorpio Sagittarius Capricorn String sign Symbol U+2652 = U+2653 U+2649 U+264A U+2648 Mar 21 - Apr 19 Apr 20 - May 20 May 21 - Jun 20 Jun 21 - Jul 22 U+264B U+264C U+264D U+264E U+264F U+2650 U+2651 Period Jan 20 - Feb 18 "\u264C"; . Feb 19 Mar 20 Jul 23 - Aug 22 Aug 23 - Sep 22 Sep 23 Oct 22 Oct 23 - Nov 21 Note: To print or store a zodiac sign in your program, use the \u escape sequence followed by the four hexadecimal digits representing the Unicode code point of that specific character. For instance, to print the Gemini sign, you can use System.out.print("\u264A"); . If you want to store the Leo sign in a variable, you can do so by assigning it like this: Nov 22 - Dec 21 Dec 22 - Jan 19 Below is a sample output of what your code should display when it is executed: Enter the month of birth (1-12): 6 Enter the day of birth (1-31): 22 Your zodiac sign is: Cancer
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class ZodiacSign public static void mainString a... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
How many numbers from 0 to 999 Hint: Think of such numbers as 3-digit strings, with leading 0-s if necessary. Explain briefly are even? are even and have distinct digits? have exactly one digit 9?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Westile Company buys plain ceramic tiles and prints different designs on them for souvenir and gift stores. It buys the tiles from a small company in Europe, so at all times it keeps on hand a stock...
-
Shankar Company uses a perpetual system to record inventory transactions. The company purchases 1,000 units of inventory on account on February 2, 2012, for $30,000 ($30 per unit) but then returns 50...
-
The operations manager of a plant making cellular telephones has proposed rearranging the production process to be more efficient. She wants to estimate the time to assemble the telephone using the...
-
Preparing a Trial Balance} The following accounts and account balances are available for Badger Auto Parts at December 31, 2018: \section*{Required:} Prepare a trial balance. Assume that all accounts...
-
1. Assume you are Vanderpool. Draft the comparison Pon just requested. 2. Which of the two routing alternatives would you recommend? Why? 3. Assume that the buyer in Saudi Arabia has made other large...
-
A random number generator will build a sequence in the following way. A random number .511 will be chosen so that 0
-
Alex was in his friend Allison's home drinking straight vodka and doing drugs. Alex told Allison that he has not taken his prescribed mental health medications for two weeks. This did not concern...
-
Peter, a classmate of yours, earns extra income by driving for the ride-sharing companies, Uber and Lyft. During the current year, he expects to earn $8,000 from Uber and $7,000 from Lyft. He was...
-
Troy Engines, Ltd., manufactures a variety of engines for use in heavy equipment. The company has always produced all of the necessary parts for its engines, including all of the carburetors,. An...
-
Milano Pizza is a small neighborhood pizzeria that has a small area for in-store dining as well as offering take-out and free home delivery services. The pizzeria's owner has determined that the shop...
-
Explain the contexts of the challenges at LAX? What were the current projects and who were the stakeholders? Was Flint seeking buy-in or engagement? What is the difference between the two as it...
-
1) If the height of a ball above the ground is H(x) 11x - x meters where x represents the number of seconds after it's thrown, what is its downward velocity when it hits the ground?
-
A.Explain the concept of time value of money in the context of simple interest. How would you use this in retirement planning? B. Compare and contrast the process of compounding to determine future...
-
Helen purchased a new business asset (seven-year property) and placed it into service on January 3, 2021. She does not elect 179 and elects out of any additional (bonus) depreciation. The cost of the...
-
In a system with light damping (c < cc), the period of vibration is commonly defined as the time interval d = 2/d corresponding to two successive points where the displacement-time curve touches one...
-
Write a program to display the text Java is fun and Java is powerful alternately with a mouse click.
-
Write a JSF program that views, inserts, and updates staff information stored in a database, as shown in Figure 33.32. The view button displays a record with a specified ID. The Staff table is...
-
Implement the following method to sort the columns in a twodimensional array. A new array is returned and the original array is intact.public static double[][] sortColumns(double[][] m)Write a test...
-
What is the difference between public relations and advocacy?
-
Explain the meaning of the terms, learning before doing, learning while doing, and learning after doing. Is one more important than the others?
-
What are the key relationships for a CEO?
Study smarter with the SolutionInn App