Listing 3.9 using an array of strings to store the animal names. Listing 1 import java.util.Scanner; 2
Question:
Listing 3.9 using an array of strings to store the animal names.
Listing
Transcribed Image Text:
1 import java.util.Scanner; 2 3 public class ChineseZodiac { public static void main(String[] args) { Scanner input = new Scanner(System.in); 4 5 System.out.print("Enter a year: "); int year = input.nextInt(); 8 switch (year % 12) { case 0: System.out.println ("monkey"); break; case 1: System.out.println("rooster"); break; case 2: System.out.println("dog"); break; case 3: System.out.println("pig"); break; case 4: System.out.println("rat"); break; case 5: System.out.println("ox"); break; case 6: System.out.println("tiger"); break; case 7: System.out.println("rabbit"); break; case 8: System.out.println("dragon"); break; case 9: System.out.println("snake"); break; case 10: System.out.println("horse"); break; case 11: System.out.println("sheep"); 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 } Enter a year: 1963 -Enter rabbit Enter a year: 1877 -Enter oX 222N 22
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 62% (8 reviews)
Program plan o Read the year form user o Display the Chinese zodiac sign for en...View the full answer
Answered By
Muhammad Umair
I have done job as Embedded System Engineer for just four months but after it i have decided to open my own lab and to work on projects that i can launch my own product in market. I work on different softwares like Proteus, Mikroc to program Embedded Systems. My basic work is on Embedded Systems. I have skills in Autocad, Proteus, C++, C programming and i love to share these skills to other to enhance my knowledge too.
3.50+
1+ Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
a. You are given an array of integers, where different integers may have different numbers of digits, but the total number of digits over all the integers in the array is n. Show how to sort the...
-
The sort method, when applied to an array of strings, returns a copy of that array in which the strings appear in alphabetical order. For example, if the variable words stored the array ['foo',...
-
Parameter: An array of strings. Return value: A list of the unique strings in the parameter array. Write, test, and debug (if necessary) PHP scripts for the specifications that above. For Exercise,...
-
For the increasing marginal-extraction-cost model of the allocation of a depletable resource, how would the ultimate cumulative amount taken out of the ground be affected by (a) An increase in the...
-
Use a Venn diagram to illustrate the relationships A B and B C.
-
When a positron and an electron collide and annihilate each other, two photons of equal energy are produced. Find the wavelength of these photons.
-
The production department of Zunni's Manufacturing is considering two numerically controlled drill presses; one must be selected. Comparison data is shown in the table below. MARR is 10 percent/year....
-
In recent years, Hrubeck Company purchased three machines. Because of heavy turnover in the accounting department, a different accountant was in charge of selecting the depreciation method for each...
-
Transform following Relational model into ER Mode id Author name dob AuthorContact id contact Manager writes authorid bookid Book bookid title edition libid memberld location opening Time...
-
1. What is the relationship between the exchange rates and relative inflation levels of the two countries? How will this relationship affect Blades Thai revenue and costs given that the baht is...
-
Write the following method that partitions the list using the first element, called a pivot.public static int?partition(int[] list)After the partition, the elements in the list are rearranged so that...
-
Write a method that returns a sorted string using the following header: public static String sort(String s) For example, sort("acb") returns abc. Write a test program that prompts the user to enter a...
-
Mortonson Company has not yet prepared a formal statement of cash flows for the 2014 fiscal year. Comparative balance sheets as of December 31, 2013 and 2014, and a statement of income and retained...
-
After graduation from METU you will start working as an operations manager at an electronics manufacturer that faces assembly-line balancing problems. You have been told that the firm needs to...
-
An organization's portfolio investment process consists of the following activities performed once a year: ideas for projects are collected along with their projected benefits, development managers...
-
You just acquired a mortgage in the amount of $249,500 at 5.75 percent interest, compounded monthly. Equal payments are to be made at the end of each month for thirty years. How much of the first...
-
An atom has a diameter of 3.00 A and the nucleus of that atom has a diameter of 7.50 10 5 . Determine the fraction of the volume of the atom that is taken up by the nucleus. Assume the atom and the...
-
1. Why are people in India prosperous everywhere else besides India? What is the evidence? 2. Why are people from Hong Kong so prosperous as compared to everywhere else? What is the evidence? 3. What...
-
Fred Owens is the loan officer of the Commonwealth Bank in Newcastle. The bank has a loan of $260 000 outstanding to Regional Delivery Service Pty Ltd, a company specialising in delivering products...
-
If the annual fixed costs are 54,000 dinars, the occupation expense represents 20%, the contribution margin is 25%, and the unit selling price is 40 dinars. Required: Calculate the closing point of...
-
Magic 8 Ball is a toy developed in the 1950s and used for fortune-telling or advice-seeking. A player asks or thinks of a yes-or-no question such as, Will I be rich someday? The player then turns the...
-
a. Write an application that accepts up to 20 Strings, or fewer if the user enters a terminating value. Store each String in one of two listsone list for short Strings that are 10 characters or fewer...
-
a. Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a double annual sales amount. Methods include a constructor that requires values for both data...
-
I'm having issues with DNS in microsoft server? What's a good way to diagnose or troubleshoot where the problem is where DNS is concerned?
-
Your company is considering a move to in-house virtualization or maybe a cloud platform. The application that is being moved is a web app that does not contain any sensitive data. The apps usage...
-
Howare cloud computing and virtualization interconnected? explain in detail.
Study smarter with the SolutionInn App