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.

Answers

Answer 1

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; }


Related Questions

what makes''emerging technologies'' happen and what impact will they have on individuals,society,and environment

Answers

Answer:

Please refer to the below for answer.

Explanation:

Emerging technology is a term given to the development of new technologies or improvement on existing technologies that are expected to be available in the nearest future.

Examples of emerging technologies includes but not limited to block chain, internet of things, robotics, cognitive science, artificial intelligence (AI) etc.

One of the reasons that makes emerging technology happen is the quest to improving on existing knowledge. People want to further advance their knowledge in terms of coming up with newest technologies that would make task faster and better and also address human issues. For instance, manufacturing companies make use of robotics,design, construction, and machines(robots) that perform simple repetitive tasks which ordinarily should be done by humans.

Other reasons that makes emerging technology happens are economic benefit, consumer demand and human needs, social betterment, the global community and response to social problems.

Impact that emerging technology will have on;

• Individuals. The positive effect of emerging technology is that it will create more free time for individuals in a family. Individuals can now stay connected, capture memories, access information through internet of things.

• Society. Emerging technology will enable people to have access to modern day health care services that would prevent, operate, train and improving medical conditions of people in the society.

• Environment. Before now, there have been global complains on pollution especially on vehicles and emission from industries. However, emerging technology will be addressing this negative impact of pollution from vehicles as cars that are currently being produced does not use petrol which causes pollution.

what makes ''emerging technologies'' happen is the necessity for it, the need for it in the society.

The impact they will have on individuals ,society,and environment is that it will improve areas of life such as communication, Transportation, Agriculture.

What is Emerging technologies?

Emerging technologies can be regarded as the technologies in which their development as will as practical applications are not yet realized.

Learn more about Emerging technologies at:

https://brainly.com/question/25110079

why is computer called and information processing machine​

Answers

Answer:

why is computer called information processing machine? Since, the computer accepts raw data as input and converts into information by means of data processing, it is called information processing machine (IPM).

Explanation:

Kith Smallest Number Real World Example

Hello!

What are five reasons why one would need to find the kth smallest number of an array? Also known as the Selection Problem.

I'm looking for 5 real world examples.

Will definitely give brainliest!


The Selection Problem is a problem where we must find the kth order statistic of a given array. As in, we must find the largest kth number. For example, if our array is [1, 3, 4, 5, 9], and k = 3, we would want to find the 3rd largest number, so our algorithm should output the number 4.

Answers

Answer:

A new coffee shop is being built. Its location is the reflection of the arcade's coordinates across

the y-axis. Which procedure will find the correct distance between the arcade and the new coffee shop

10.7 LAB: Fat-burning heart rate Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burning_heart_rate() to

Answers

Answer:

I've written in python

Explanation:

age = int(input("Enter the person's age: ")

def fat_burning_heart_rate(x):

rate =( 70/100 * 220 ) - age

print(fat_burning_heart_rate(age))

Gary frequently types his class assignment. His ring automatically types the letter O. What is Gary using when he types?

A.Keyboard shortcut
B.Home row
C.Muscle memory
D.Windows logo

Answers

the answer would be C
The answer is C. Muscle memory


Hope this answers your question

Which branch structure does a program use to output "Yes" if a variable's value is positive, or "No" otherwise?

Answers

Answer:

Selection control structure

Explanation:

This is often referred to as if-conditional statement;

This condition tests for a condition and performs a sequence of operation depending on the result of the condition;

Take for instance, the following program written in python

x = int(input("enter any number: "))

if x < 0:

  print("Yes")

else

  print("No")

The above checks if the input number is less than 0,

If the condition is true, it prints Yes

If otherwise, it prints No

Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string backward and returns nothing. The function should stop processing and return when the end of the string is encountered. Note that like an array, the square brackets ( [ ] ) operator can be used to iterate through the characters in a string.

Answers

Answer:

void stringReverse(string s, int start){

   if(s[start]=='\0'){

       return;

   }

   else{

       stringReverse(s.substr(1,s.length()-1),start+1);

       cout<<s[start];

   }

}

Explanation:

Write a method named coinFlip that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of whitespace-separated tokens. Assume that the input file data represents results of sets of coin flips. A coin flip is either the letter H or T, or the word Heads or Tails, in either upper or lower case, separated by at least one space. You should read the sequence of coin flips and output to the console the number of heads and the percentage of heads in that line, rounded to the nearest whole number. If this percentage is 50% or greater, you should print a "You win!" message; otherwise, print "You lose!". For example, consider the following input file: H T H H T Tails taIlS tAILs TailS heads HEAds hEadS For the input above, your method should produce the following output: 6 heads (50%) You win!

Answers

Answer:

Here is the JAVA program:

import java.io.*;

import java.util.*;

public class Main {

public static void main(String[] args) throws FileNotFoundException{ //the start of main() function body, it throws an exception that indicates a failed  attempt to open the file

Scanner input = new Scanner(new File("file.txt")); //creates a Scanner object and a File object to open and scan through the file.txt    

coinFlip(input);    } //calls coinFlip method

public static void coinFlip(Scanner input) { //coinFlip method that accepts as its parameter a string input holding a file name

while(input.hasNextLine()) { //iterates through the input file checking if there is another line in the input file

Scanner scan = new Scanner(input.nextLine()); //creates a Scanner object

int head = 0; // stores count of number of heads

int count = 0; //stores count of  total number of tokens

while(scan.hasNext()) { //iterates through the sequence checking if there is another sequence in the input file

String token= scan.next(); // checks and returns the next token

if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads")) { //compares H or Heads with the tokens in file ignoring lower case and upper case differences

           head++;                } //if a token i.e. any form of heads in file matches with the H or Heads then add 1 to the number of heads

           count++;            } //increment to 1 to compute total number of counts

double result = Percentage(head, count); //calls Percentage method passing number of heads and total counts to compute the percentage of heads

System.out.println(head + " heads " + "(" + result +"%)"); // prints the number of heads

if(result >= 50.00) { //if the percentage is greater or equal to 50

System.out.println("You win!");} //displays this message if above if condition is true

else //if the percentage is less than 50

{System.out.println("You lose!");}  }    } //displays this message if above if condition is false

public static double Percentage(int h, int total) { //method to compute the percentage of heads

double p = (double)h/total* 100; // divide number of heads with the total count and multiply the result by 100 to compute percentage

return p;    } } //returns result

Explanation:

The program is well explained in the comments mentioned with each line of the above code. I will explain how the method coinFlip  works.

Method coinFlip accepts a string holding a file name as its parameter. It opens that file and reads its contents as a sequence of tokens. Then it reads and scans through each token and the if condition statement:

if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads"))

checks if the each token in the sequence stored in the file is equal to the H or Heads regardless of the case of the token. For example if the first token in the sequence is H then this if condition evaluates to true. Then the head++ statement increments the count of head by 1. After scanning each token in the sequence the variable count is also increased to 1.

If the token of the sequence is HeAds then this if condition evaluates to true because the lower or upper case difference is ignored due to equalsIgnoreCase method. Each time a head is found in the sequence the variable head is incremented to 1.

However if the token in the sequence is Tails then this if condition evaluates to false. Then the value of head variable is not incremented to 1. Next the count variable is incremented to 1 because this variable value is always incremented to 1 each time a token is scanned because count returns the total number of tokens and head returns total number of heads in the tokens.

Percentage method is used to return the percentage of the number of heads in the sequence. It takes head and count as parameters (h and total). Computes the percentage by this formula h/total* 100. If the result of this is greater than or equal to 50 then the message  You win is displayed otherwise message You lose! is displayed in output.

What is resource Management in Wireless Communication ? Explain its Advantages?

Answers

Answer:

Resource management is the system level transmission cellular networks and wireless communication.

Explanation:

Wireless communication is the process to continue to the address for faster response time,to the resource management.

Transmission is the provided by that more utilization and wireless resources available,and to discovered data.

Wireless communication system to demand the larger bandwidth and transmission using development to the system.

Wireless communication resources management the larger bandwidth and reliable transmission consumed all the system layer.

Resource management techniques tool are used in a preliminary concepts or mathematical tools,and average limited power battery.

Resource management are they necessary mathematical and fundamental tools are used in wireless communication.

Wireless communication in the provide that wireless industry in a wireless communication.

Giving BRANLIEST IFF CORRECT What is the label called for each column in a database? Field File Record Title

Answers

Answer:

Title

Explanation:

the others describe other items in a database

Answer:

Title

Explanation: idek but I got it correct on a quiz

b. Does “refactoring” mean that you modify the entire design iteratively? If not, what does it mean?

Answers

Explanation:

Refactoring consists of improving the internal structure of an existing program's source code, while preserving its external behavior. 

collection of any data can be database
False
True​

Answers

Answer:

True is the answer

have a great day

You have a Nano Server named Nano1. Which cmdlet should you use to identify whether the DNS Server role is installed on Nano1

Answers

Answer:

The correct solution will be "Get-Package".

Explanation:

The accreditation property defines a domain as well as client initials with computer authorizations for executing commands. Mostly on the virtual device, the argument ScriptBlock executes the Get-Package cmdlet. This order obtains from some kind of special introductory commercial software downloaded on either the user's computer.

Secure email technique that provides confidentiality, along with authentication, integrity, and non-repudiation. It uses a centralized trust model where users get a certificate from a trusted CA.

a. True
b. False

Answers

Answer:

a

Explanation:

just put a

Develop a simple game that teaches kindergartners how to add single-digit numbers. Your function game() will take an integer n as input and then ask n single-digit addition questions. The numbers to be added should be chosen randomly from the range [0, 9] (i.e.,0 to 9 inclusive). The user will enter the answer when prompted. Your function should print 'Correct' for correct answers and 'Incorrect' for incorrect answers. After n questions, your function should print the number of correct answers.

Answers

Answer:

2 correct answer out of 3

notes on secondary memory​

Answers

Answer:

non-volatile and persistent in nature

Agile Software Development is based on Select one: a. Iterative Development b. Both Incremental and Iterative Development c. Incremental Development d. Linear Development

Answers

Answer:

b. Both incremental and iterative development.

Explanation:

Agile software development is based on both incremental and iterative development. It is an iterative method to software delivery in which at the start of a project, software are built incrementally rather than completing and delivering them at once as they near completion.

Incremental development means that various components of the system are developed at different rates and are joined together upon confirmation of completion, while Iterative development means that the team intends to check again components that makes the system with a view to revising and improving on them for optimal performance.

Agile as an approach to software development lay emphasis on incremental delivery(developing system parts at different time), team work, continuous planning and learning, hence encourages rapid and flexible response to change.

Arrays are commonly used to store data items. Arrays can be managed in ways that fill, iterate over, add to, and delete items from the array. Why is it useful to store multiple pieces of information?

Answers

Answer:

mark me brainlist

Explanation:

Bharath has made a table of content for his document in Open Office, in which he wants to make few changes, but he is unable to make the changes. Give reason. Explain how he can make the necessary changes

Answers

Answer:

H cannot update it because it is probably protected.

If you cannot click in the table of contents, it is probably because it is protected. To disable this protection, choose Tools > Options > OpenOffice.org Writer > Formatting Aids, and then select Enable in the Cursor in protected areas section. If you wish to edit the table of contents without enabling the cursor, you can access it from the Navigator.

Explanation:

. To update a table of contents when changes are made to the document:

Right-click anywhere in the TOC.

From the pop-up menu, choose Update Index/Table. Writer updates the table of contents to reflect the changes in the document.

You can also update the index from the Navigator by right-clicking on Indexes > Table of Contents1 and choosing Index > Update from the pop-up menu.

2. Which property is used for hiding text of the textbox?
a) Password Char b) Text Char c) Char Password d) Pass Char

Answers

Answer:

password char

Explanation:

The password char property allows the text being written in the textbox to be hidden in the form of dots or stars. As such the user entering the password is secure, as no one nearby can know the password by watching the texts.

Giving Brainliest IFFF CORRECT

Jonathan needs to create a chart that shows the change in weight he can lift in weightlifting class. Which chart or graph should he use?

Bar graph

Column chart

Line graph

Pie chart

Answers

Answer:

line graph

Explanation:

the change in weight is linear

Answer:

Line Graph

Explanation:

Linear Weight change

1110011*110011 binary multiplication

Answers

122113420121

Explanation:

Answer:

110110101001

Explanation:

You have to multiply them normally and then add then in a binary manner..

Remember these are binary numbers ( 1+1=0,

1+0=1, 0+0=0)

Give five types of hardware resource and five types of data or software resource that can usefully be shared. Give examples of their sharing as it occurs in practice in distributed systems.

Answers

Answer:

Answered below

Explanation:

Hardware resources that can be usefully shared and also examples of their sharing include;

A) CPU servers, which carry out computations for clients.

B) Network capacity transmission of data or packet transmission is done using the same circuit, meaning many communication channels share the same circuit.

C) Screen networks windows systems which enable processes in remote computers to update the contents of their local server.

D) Memory cache server.

E) Disk file server, virtual disk server.

Softwares include;

A) Web-page web servers which allow client programs to have read-only access to page contents.

B) Database whose contents can be usefully shared.

C) File servers enable multiple users access to files .

D) Objects can be shared in distributed systems example shared ticket booking, whiteboard etc.

E) Exclusive lock which enables the coordination of accessing a special resource.

Diana is working on an Access file. She added a rectangle to the title of her form and would like to change the color of the rectangle border. To complete this task, Diana goes into Design view, clicks on Property Sheet, and then clicks on the Other tab. She is unable to find the Border Color option to make the change. What error did Diana make? A.She should have used Format view instead of Design view.
B.She should have clicked Controls before clicking Property Sheet.
C.She should have clicked on the Format tab after clicking Property Sheet.
D.She should have looked for the Border Width option instead of the Border Color option.

Answers

Answer:

A

Explanation:

she should have used format view instead of design view

Tuesday
write the
correct
answer
Text can be celected using
2 A mouse
device of
is
ch
3 Scrolls bars are
buttons which assist
upwards downwards
sideways to
skole
Text can be selectedusing

Answers

Answer:

number 2 is the awnser(the mouse)

Performing binary search on an unsorted list will always return the correct answer in O(n) time where n is the length of the list.
a) true
b) false

Answers

Answer:

B. False

Explanation:

Binary search does not work in an unsorted list, therefore it will not return the correct answer in 0(n) time.

For an unsorted list, linear search is the better way of searching for algorithms.

For a binary search, it goes through a sorted list to locate a desired element. It repeats its processes until it picks the correct element it is looking for.

Using virtualization comes with many advantages, one of them being performance. Which of these is NOT another realistic advantage of using virtualization over dedicated hardware?a. There are improvements in security and high availability during outage.b. There are cost benefits.c. Maintenance and updates are simplified or eliminated.d. There are fewer points of failure.

Answers

Answer:

a. There are improvements in security and high availability during outage

Explanation:

Virtualization occurs when data that could be in several formats (for example, storage devices) are made to appear real through a software. There are virtualization providers who act as third-party between users and the original manufacturers of the software. While virtualization has received wide popularity in recent times because of the several advantages it offers of which cost-saving is included, it also has some disadvantages. One of them from the options provided is the possibility of a security breach and its uncertain availability.

The security breach arises because of the proliferation of information on the virtual space. This information can be accessed by unauthorized hackers. Also since third-party providers are the usual providers of virtualization services, the availability depends on them because if they shut down, users can no longer access the software.

Write a program that asks the user to enter in a username and then examines that username to make sure it complies with the rules above. Here's a sample running of the program - note that you want to keep prompting the user until they supply you with a valid username:

Answers

user_in = input ("Please enter your username: " )

if user_in in "0123456789":

print ("Username cannot contain numbers")

elif user_in in "?":

print ("Username cannot continue special character")

else:

print (" Welcome to your ghetto, {0}! ".format(user_in))

_________ enables customers to combine basic computing services,such as number crunching and data storage,to build highly adaptable computer systems.A) IaaSB) EAP peerC) CPD) SaaS

Answers

Answer:

The correct answer to the question is option A (IaaS)

Explanation:

IaaS (Infrastructure as a Service) can be used for data storage, backup, recovery, web hosting, and various other uses as it is cost-effective, and it also has secured data centers. It is a service delivery method by a provider for cloud computing as it enables customers to be offered the service the possibility to combine basic computing services to build and direct access to safe servers where networking can also be done. These services rendered by the providers allow users to install operating systems thereby making it possible to build highly adaptable computer systems.

SaaS (Software as a Service): Here, the service provider bears the responsibility of how the app will work as what the users do is to access the applications from running on cloud infrastructure without having to install the application on the computer.

The cloud provider (CP) as the name suggests is anybody or group of persons that provide services for operations within the cloud.

Ann. An employee in the payroll department, has contacted the help desk citing multiple issues with her device, including: Slow performance Word documents, PDFs, and images no longer opening A pop-up Ann states the issues began after she opened an invoice that a vendor emailed to her. Upon opening the invoice, she had to click several security warnings to view it in her word processor. With which of the following is the device MOST likely infected?

a. Spyware
b. Crypto-malware
c. Rootkit
d. Backdoor

Answers

Answer:

d. Backdoor

Explanation:

A backdoor is a type of malware that overrides security checks and authentications to access a computer or embedded device.

When this is done, remote access is granted and databases and servers can be accessed and modified. Attackers can also give remote commands to the system.

What happened to Ann in the payroll department is probably a backdoor attack that affected her device.

Other Questions
The numbers 1,2,3,4,5,6,7,8,9. How would you put them in each of a square block to create the sum on each line to make the number 15. The sum of each diagonals should also be 15. "The interest rate charged from the banks to broker-dealers on loans where securities are collateral is the:" Hiiii can you help me ? A student conducts an experiment to determine how the temperature of water affects the time for sugar to dissolve. In each trial, thestudent uses a different amount of water and a different temperature of water.What is wrong with this experimental design? How does the use of hydroelectric energy compare to the use of coal?a.Hydroelectric energy is more commonly used than coal.b.Hydroelectric energy is associated with less waste production than coal.c.Hydroelectric energy has a larger environmental impact than coal use.d.Hydroelectric energy requires more land space than coal use. when you turn on music on your phone, what energy transformation takes place ? Which clause in a mortgage allows a lender to increase the interest rate? A.) Defeasance B.) Escalation C.) Acceleration D.) Exculpatory factorise [tex]x^{2} + 11x[/tex] C.''( ) can someone help me asap please Common stock is called a hybrid security because it takes on the attributes of both preferred stock and bonds.a. Trueb. False PLS HELP ME ON THIS QUESTION I WILL MARK YOU AS BRAINLIEST IF YOU KNOW THE ANSWER PLS GIVE ME A STEP BY STEP EXPLANATION!!Data should be analyzed using each of the following except:A. measures of central tendencyB. shapeC. population sizeD. spread What was the purpose of setting 4 time zones in the continental untied states I need help plz step by step explanation Somebody please help me on this math problem Norris Co. has developed an improved version of its most popular product. To get this improvement to the market, will cost $48 million and will return an additional $13.5 million for 5 years in net cash flows. The firm's debt-equity ratio is .25, the cost of equity is 13 percent, the pretax cost of debt is 9 percent, and the tax rate is 30 percent. What is the net present value of this proposed project? Find the slope of the line through each pairA.) (8, -7) and (5, -3). B.) (-5, 9) and (5, 11). C.). (-8, -4) and (-4, -9).Show your work. [tex]Solve. Clear fraction first.6/5 + 2/5 x = 89/30 + 7/6 x + 1/6[/tex] What does the cross sign in the middle mean??? Identify the theme of Audre lorde poem "" Fourth of July""