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
Vanyuwa [196]
2 years ago
15

Write a method named lastIndexOf that accepts an array of integers and an * integer value as its parameters and returns the last

index at which the * value occurs in the array. The method should return -1 if the value is not * found.
Computers and Technology
1 answer:
evablogger [386]2 years ago
7 0

Answer:

The method is as follows:

public static int lastIndexOf(int [] numbers, int num){

    int lastIndex = numbers[0];

    for(int i =0; i<numbers.length;i+=num){

        lastIndex = numbers[i];

    }

    return lastIndex;

}

Explanation:

This defines the method

public static int lastIndexOf(int [] numbers, int num){

This initializes the lastIndex to the first element of the array

    int lastIndex = numbers[0];

This iterates through every "num" element of the array

    for(int i =0; i<numbers.length;i+=num){

This gets the current index... until the last

        lastIndex = numbers[i];     }

This returns the last

    return lastIndex; }

You might be interested in
Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of strings
Makovka662 [10]

The code that examines all the strings in the input source and determines how long the longest string (or strings are) is the following:

total = 0; % initial value is zero, in every while loop it will be incremented

while(input.hasNextInt()){

total += input.nextInt( );

}

7 0
2 years ago
Read 2 more answers
Tomahawk Industries develops weapons control systems for the military. The company designed a system that requires two different
mojhsa [17]

Answer:

<em>D. Separation of duties</em>

Explanation:

Separation of duties (SoD) is a fundamental concept in internal controls and is the hardest and often the most expensive to achieve.

<em>This aim is accomplished by distributing the tasks and associated permissions among multiple people for a specific security system.</em>

7 0
3 years ago
What would be the best thing you could do to prepare yourself to work for a company that has embraced globalization. A) learn ho
laila [671]

Answer:B

Explanation: your co workers might not know English so you would need to learn their language :)

5 0
3 years ago
Read 2 more answers
Ima go to sleep but I ask a favor can u guys go on eBay Amazon and find the cheapest pre bilt that is actually good
katrin2010 [14]

Explanation:

what do specifically want to buy??

8 0
3 years ago
Read 2 more answers
PLS HELP
kvasek [131]

Answer:

informative, discrimiitive,critical thats the order

4 0
3 years ago
Other questions:
  • Assume the existence of a class named window with functions named close and freeresources, both of which accept no parameters an
    13·1 answer
  • True or false A ClassB fire involves live electrical equipment
    5·1 answer
  • The ability of services to grow or shrink based on need is called __________.
    14·1 answer
  • What can search the internet and select elements based on important words
    10·1 answer
  • Where (what memory location) is the data read from for the following code:
    12·1 answer
  • # q7 - create function readFileFirstLast() to meet the conditions below
    10·1 answer
  • Jim wants to buy a car, but he’ll probably only need it for a couple of years. He has a short commute to work, so he won’t be pu
    5·1 answer
  • Does Buzz or APEX shows all your due assignments on the left of the main home screen?
    11·1 answer
  • Out-of-order instruction execution can cause problems because a later instruction may depend on the results from an earlier inst
    6·1 answer
  • Which of the following is true about named ranges?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!