subject

Write a Java program that asks the user to enter an array of integers. The program should prompt the user for the number of elements in the array and then the elements of the array. Theprogram should then call a method named minGap that accepts the array entered by the user as a parameter and returns the minimum 'gap' between adjacent values in the array. The main method should then print the value returned by the method. The gap between two adjacent values in an array is defined as the difference in value between the first element and the secondelement. For example, suppose the user entered the following array of integers {1, 3, 6, 5, 12}The first gap is 2 (3 - 1), the second gap is 3 (6 - 3), the third gap is 1 (6 - 5) and the fourth gap is 5 (12 - 6). Thus, the call of minGap(array) should return 1 because that is the smallest gap in the array. If you are passed an array with fewer than 2 elements, you should return 0.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:00
1. you have a small business that is divided into 3 departments: accounting, sales, and administration. these departments have the following number of devices (computers, printers, etc.): accounting-31, sales-28, and administration-13. using a class c private network, subnet the network so that each department will have their own subnet. you must show/explain how you arrived at your conclusion and also show the following: all available device addresses for each department, the broadcast address for each department, and the network address for each department. also, determine how many "wasted" (not usable) addresses resulted from your subnetting (enumerate them).
Answers: 3
question
Computers and Technology, 24.06.2019 10:20
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
Answers: 1
question
Computers and Technology, 24.06.2019 15:20
Local area networks use many of the same network technologies and the internet, only on a smaller scale. devices that access lans are equipped with a network interface that contains circuitry for wireless or wired connections. devices also have a physical address, in addition to the ip addresses acquired from a dhcp server. the most popular wired technology is . the most popular wireless technology is , which can be configured as a(n) or star topology. setting up a lan and configuring its router is fairly easy. the first step is to change the standard to one that is secure. next, create a(n) that uniquely identifies the network by name. it is also important to activate wireless to prevent wireless signals from being intercepted during transmission. a limited-access network can be created for visitors to use. by activating , the router will be able to assign ip addresses to each device that joins the network. to connect to a secure lan that is protected by encryption, an encryption , or password, is required. lans can be used to access data collected by iot devices and the networks that tie these devices together. technologies such as rfid, nfc, bluetooth smart, zigbee, and z-wave offer -power links, essential for battery-powered devices that can’t expend excess amounts of energy transmitting data.
Answers: 1
You know the right answer?
Write a Java program that asks the user to enter an array of integers. The program should prompt the...
Questions
question
History, 15.02.2021 20:30
Questions on the website: 13722360