answer.
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]
2 years ago
12

In Java please.

Computers and Technology
1 answer:
Marizza181 [45]2 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
A(n) ______ consists of programs designed to make users more productive and/or assist them with personal tasks.
Vinil7 [7]

Answer:

Application Programs

Explanation:

Unlike the system software which interacts with the computer’s hardware to operate, the application software is designed purposely for the end users. They include programs like Word, browsers, and many other programs that we interact with every day to assist us achieve our daily tasks. We install application software according to what we want them to do for us.

3 0
2 years ago
When a file is transferred between two computers, two acknowledgment strategies are possible. In the first one, the file is chop
ExtremeBDS [4]

Answer:

Client server system, packets in the network and the discussion regarding two approaches have been done. See the attached pictures.

Explanation:

See attached pictures for explanation.

4 0
2 years ago
Write code that prints: Ready! firstNumber ... 2 1 Run! Your code should contain a for loop. Print a newline after each number a
LUCKY_DIMON [66]

Complete Question:

Write code that prints: Ready! userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: userNum = 3 outputs: Ready! 3 2 1 Blastoff!

Answer:

public class TestClock {

   public static void main(String[] args) {

       int userNum= 3;

       System.out.print("Ready! "+userNum+" ");

       for (int i=userNum;i>1; i--){

           userNum--;

           System.out.print(userNum+" ");

       }

       System.out.println("Blasoff!");

   }

}

Explanation:

  1. Create and initialize userNum
  2. Use System.out.print to print the sequence ("Ready! "+userNum+" ") on same line
  3. use for statement with this condition for (int i=userNum;i>1; i--) decremeent userNum by 1 after each loop iteration and print userNum on same line
  4. outside the for loop print "Blasoff!"
3 0
2 years ago
Read 3 more answers
Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
fredd [130]

Answer:

1.c 2.a

Explanation:

If the new emails she doesn't need could be ignored in spam. the old ones are useless so trash em.

5 0
2 years ago
Read 2 more answers
Your company has decided it wants to build a file server and store data that can be shared by coworkers. You were asked to resea
Yuri [45]
Tylenuuutiunumiiute joy. Until ouuu I gotta y us huh iuoihtytutb to the ng ru
3 0
2 years ago
Other questions:
  • Mr. Cooper would like to customize his Excel software so his students can create an electronic graph in Excel for their lab repo
    6·1 answer
  • Rupa would like to quickly insert a table into her document without having to worry about formatting the data in the table. Whic
    5·2 answers
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • You have several pictures of different sizes that you would like to frame.A local picture framing store offers two types of fram
    15·1 answer
  • Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • Return 1 if ptr points to an element within the specified intArray, 0 otherwise.
    7·1 answer
  • Which two functions are provided to users by the context-sensitive help feature of the Cisco IOS CLI? (Choose two.)
    7·1 answer
  • Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is
    14·1 answer
  • Write a method called printRangeOfNumbers that accepts a minimum, maximum numbers as parameters and prints each number from mini
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!