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]
3 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]3 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
How many different messages can be transmitted in n microseconds using three different signals if one signal requires 1 microsec
SIZIF [17.4K]

Answer:

a_{n} = 2/3 . 2^n + 1/3 . (-1)^n

Explanation:

Let a_{n} represents number of the message that can transmitted in <em>n </em>microsecond using three of different signals.

One signal requires one microsecond for transmittal: a_{n}-1

Another signal requires two microseconds for transmittal: a_{n}-2

The last signal requires two microseconds for transmittal: a_{n}-2

a_{n}= a_{n-1} + a_{n-2} + a_{n-2} = a_{n-1} + 2a_{n-2}, n ≥  2

In 0 microseconds. exactly 1 message can be sent: the empty message.

a_{0}= 1

In 1 microsecond. exactly 1 message can be sent (using the one signal of one  microseconds:

a_{0}= 1

2- Roots Characteristic equation

Let a_{n} = r^2, a_{n-1}=r and a_{n-2}= 1

r^2 = r+2

r^2 - r - 2 =0                 Subtract r+6 from each side

(r - 2)(n+1)=0                  Factorize

r - 2 = 0 or r +1 = 0       Zero product property

r = 2 or r = -1                 Solve each equation

Solution recurrence relation

The solution of the recurrence relation is then of the form a_{1} = a_{1 r^n 1} + a_{2 r^n 2} with r_{1} and r_{2} the roots of the characteristic equation.

a_{n} =a_{1} . 2^n + a_{2}.(-1)"

Initial conditions :

1 = a_{0} = a_{1} + a_{2}

1 = a_{1} = 2a_{1} - a_{2}

Add the previous two equations

2 = 3a_{1}

2/3 = a_{1}

Determine a_{2} from 1 = a_{1} + a_{2} and a_{1} = 2/3

a_{2} = 1 - a_{1} = 1 - 2 / 3 = 1/3

Thus, the solution of recursion relation is a_{n} = 2/3 . 2^n + 1/3 . (-1)^n

6 0
4 years ago
What is the answer to 4.9 Code Practice: Question 2
bixtya [17]

Answer:

sum = 0

for i in range(20, 100, 10):

sum = sum + i

Print(sum)

Explanation:

7 0
3 years ago
Without any formal planning, the president of a software company remarks in a speech that new technologically advanced software
ahrayia [7]

Answer:

<em>Imposed project deadlines.</em>

Explanation:

The term of project management imposed deadline<em> refers mainly to the calendar-based dividing line used to determine a fixed time or date on which the project management team has projected and/or developed that the particular schedule of work and/or schedule of work events.</em>

6 0
4 years ago
What can be designed to create annoying glitches or destoey data?...
daser333 [38]

WELL YOU ARE RIGHT its virus

hope it helps

3 0
4 years ago
Read 2 more answers
What do you use to put information into a computer?
OlgaM077 [116]
D, D,A,t,C,CA,D,t, D
5 0
3 years ago
Read 2 more answers
Other questions:
  • I NEED HELP NOW PLEASE!!!!!!
    6·2 answers
  • How you think the new values of your generation will affect economic decisions?
    11·1 answer
  • The bluecross blueshield federal employee program (fep) is a(n) __________ health benefits program established by an act of cong
    8·1 answer
  • What do computer viruses eat for snacks?
    7·2 answers
  • A microphone is a type of electronic.<br><br> True/Faulse
    14·1 answer
  • How should the teachers respond to the parental complaints of student C? If they fail the student, the student will likely be re
    11·1 answer
  • Network administrators use _______ technology to get antivirus updates to be automatically downloaded on employees' workstations
    15·1 answer
  • What will be result of below if statement.
    13·1 answer
  • One standard photo editing software programs for professionals is which of the following?
    11·2 answers
  • Creation of network is known as…?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!