1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sloan [31]
3 years ago
12

In Java please.

Computers and Technology
1 answer:
Marizza181 [45]3 years ago
7 0

Answer:

See explaination

Explanation:

public class YearToAnimal {

static void yearToAnimalZodiac(int year){

String[] animals = {"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"};

int baseYear = 2020;

int index = (year - baseYear) % 12;

// in case of negative index, change it to positive

if(index < 0)

index = 12 + index;

System.out.println(year + ": " + animals[index]);

}

// some test cases

public static void main(String[] args) {

yearToAnimalZodiac(2020);

yearToAnimalZodiac(2021);

yearToAnimalZodiac(2019);

yearToAnimalZodiac(2009);

yearToAnimalZodiac(2008);

yearToAnimalZodiac(2007);

}

}

You might be interested in
The class attribute
Elodia [21]

the answer is d plz let me know if i got it right

6 0
3 years ago
you are a new lenovo service provider and need to use the recovery utility information on the lenovo support website. this infor
yawa3891 [41]

Based on the above, the person that  you  should contact to request a service provider user id and password is Regional leads

<h3>Who is a Regional leads?</h3>

The stores, merchandise, and general presence of the company in a given region are managed by region leaders. They make sure the objectives are achieved. If not, they come up with plans to achieve the goals. Leaders in a region are expected to comprehend both the local economy and its historical context.

A regional lead is a manager, educator, or administrator who is in charge of finding and supporting workforce champions within organizations within their assigned region. Hence, he or she is the best person for you to contact.

Learn more about Region from

brainly.com/question/2001834
#SPJ1

8 0
2 years ago
Which term is used to describe a computer-based method of communication in which users can type and view informal messages sent
Vsevolod [243]
The answer is instant messaging (IM).  This  is used to describe a computer-based method of communication in which users can type and view informal messages sent to one or more recipients, and view the responses immediately.  Instant Messaging (IM) <span>is a type of online chat that offers real-time text transmission over the Internet. </span>
3 0
4 years ago
What are midi signals
gregori [183]

Answer: is a unified standard used when recording the sounds of instruments

3 0
3 years ago
Read 2 more answers
A computer processes data using only 1s and 0s.<br><br> A.True<br><br> B.False
stiks02 [169]
True. That data is called binary
4 0
4 years ago
Other questions:
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • Which best compares and contrasts broadcasting a slide show and sending the presentation as a PDF?
    10·1 answer
  • The __________ is the system of official channels that carry organizationally approved messages and information.
    15·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • Discuss the following
    14·1 answer
  • 01 Describe all the possible component of a chart​
    8·1 answer
  • Write a code segment that uses a loop to create and place nine labels into a 3-by-3 grid. The text of each label should be its c
    6·1 answer
  • How can you have internet without subscribing to cable?
    13·1 answer
  • Which type of malware prevents you from accessing files stored on your computer?
    10·2 answers
  • True or false computers are an application of the on-off principle
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!