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
True or False: You cannot restore a deleted file on a volume protected by the Recycle Bin. Select one: a. False b. True
artcher [175]

Answer:

The answer is false

Explanation:

When you delete a file imagine you are erasing the path there. The file still will exist until it is wrote over. If you wish to retrive it many programs can do it for you.

5 0
4 years ago
Dr. Watson has been kidnaped! Sherlock Holmes was contacted by the kidnapper for ransom. Moments later he received a message fro
adelina 88 [10]

Answer:

please mark me brainlist

Explanation:

This algorithm works for n number of strings in python3

Input:

83217

8213897

683147

Output:

837

from itertools import product

import pdb

import numpy as np

def neigh(index):

N = len(index)

for ri in product((0, -1), repeat=N):

if not all(i == 0 for i in ri):

yield tuple(i + i_rel for i, i_rel in zip(index, ri))

def longestCommonSubSequenceOfN(sqs):

numberOfSequences = len(sqs); # to know number of sequences

lengths = np.array([len(sequence) for sequence in sqs]); # to know length of each sequences placed in # array

incrLengths = lengths + 1; # here we are taking no .of sequences +1

lengths = tuple(lengths); # making lengths into tuple to make it mutable

inverseDistances = np.zeros(incrLengths);

ranges = [tuple(range(1, length+1)) for length in lengths[::-1]]; # finding ranges from 1 to each lengths

for tupleIndex in product(*ranges):

tupleIndex = tupleIndex[::-1];

neighborIndexes = list(neigh(tupleIndex)); # finding neighbours for each tupled index value and # store them in list

operationsWithMisMatch = np.array([]); # creating array which are miss matched

 

for neighborIndex in neighborIndexes:

operationsWithMisMatch = np.append(operationsWithMisMatch, inverseDistances[neighborIndex]);

#appending newly created array with operations miss match and inverseDistances

operationsWithMatch = np.copy(operationsWithMisMatch);

# copying newly generated missmatch indexs

operationsWithMatch[-1] = operationsWithMatch[-1] + 1;

# incrementing last indexed value

chars = [sqs[i][neighborIndexes[-1][i]] for i in range(numberOfSequences)];

# finding a string(chars) with neighbour indexes and checking with other sequences

if(all(elem == chars[0] for elem in chars)):

inverseDistances[tupleIndex] = max(operationsWithMatch);

else:

inverseDistances[tupleIndex] = max(operationsWithMisMatch);

 

subString = ""; # resulted string

mainTupleIndex = lengths; # copying lengths list to mainTupleIndex

while(all(ind > 0 for ind in mainTupleIndex)):

neighborsIndexes = list(neigh(mainTupleIndex));

#generating neighbour indexes with main tuple index in form of list

anyOperation = False;

for tupleIndex in neighborsIndexes:

current = inverseDistances[mainTupleIndex];

if(current == inverseDistances[tupleIndex]): # comparing indexes in main tuple index and inverse #distance tuple index

mainTupleIndex = tupleIndex;

anyOperation = True;

break;

if(not anyOperation): # if anyoperation is False then we are generating sunString

subString += str(sqs[0][mainTupleIndex[0] - 1]);

mainTupleIndex = neighborsIndexes[-1];

return subString[::-1]; # reversing resulted string

sequences = ["83217", "8213897", "683147"]

print(longestCommonSubSequenceOfN(sequences)); #837

8 0
3 years ago
What computer has special software that allows it to deliver web pages to the Internet?
Vlad1618 [11]
Web browser (Google Chrome, Safari, Internet Explorer, Edge, etc. )
3 0
3 years ago
Read 2 more answers
A computer is completely compromised when it wont turn on or operate. What is the best way to fix
miskamm [114]

There really is no getting it back, if it is from a virus, then you need to buy a new computer. If it is something internal, depending on what type of computer you have it might just be best to buy a new one. Hope this helps :-)

8 0
3 years ago
Read 2 more answers
Identify and describe the kind of trouble ticket system you would recommend in the following scenario hey small marketing firm d
yarga [219]

Answer:

There is no hesitation at all that the company is going through recession, and will for next 10 years. Hence, we need to be crystal clear with our budget for this company, and provide low cost solutions. The company requires trouble ticket system. The simplest can be a back-end service to store trouble ticket details, and with API like ticket check, cancellation on fraud and many such. However, the company can select the most important from this list as well, and leave the remaining, as software company is going to charge for this.  Also. we can build a simple app for the company with APIs that we developed with good design, and we can make use of web socket programming to ensure client server communication, and data transfer. We can make use of the chatbots as well, and that is the cheapest definitely currently.

Explanation:

The answer is self explanatory.

8 0
3 years ago
Other questions:
  • The conscious process of planning and controlling how you spend your time is called?
    15·1 answer
  • How do keygens work?
    12·1 answer
  • How do you represent the decimal integer 50 in binary?
    14·1 answer
  • Piers wants to take a course on XML. He is a certified web designer, but he has not used XML before. How can he use XML to impro
    6·1 answer
  • Which files have not been processed by your camera or computer?
    13·1 answer
  • 1) List at least five smaller behaviors you could break the complex behavior "brushing my teeth" into.
    14·2 answers
  • Abigail is writing an email to Justine Swenson, a friend of her best friend, Jane, inviting her to a get-together.
    7·1 answer
  • Is this website real? Or is it a scam?
    11·1 answer
  • The cardinality of the friend_of relationship set between two student entities in the student entity set should be:
    5·1 answer
  • (50 POINTS)Look at the code in the example below, and then answer the question.
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!