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
viktelen [127]
3 years ago
5

Write a program that prompts the user to enter the number of integer numbers you need to enter, then ask user to enter these int

eger numbers. Your program should contain an indexOfLargestElement method, which is used to return the index of the largest element in an array of integers.
Computers and Technology
1 answer:
nadya68 [22]3 years ago
8 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 Scanner ob = new Scanner(System.in);

 System.out.println("How many numbers? ");

 int n = ob.nextInt();

       int[] arr = new int[n];  

 for (int i=0; i<n; i++) {

     System.out.print("Enter the number: ");

     arr[i] = ob.nextInt();

 }

    System.out.println(indexOfLargestElement(arr));

}

public static int indexOfLargestElement(int[] arr) {

    int max = arr[0];

    int maxIndex = 0;

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

        if (arr[i] >= max) {

            max = arr[i];

            maxIndex = i;

        }

    }

    return maxIndex;

}

}

Explanation:

Create a method called indexOfLargestElement that takes one parameter, an array

Initialize the max and maxIndex

Create a for loop iterates throgh the array

Check each element and find the maximum and its index

Return the index

Inside the main:

Ask the user to enter how many numbers they want to put in array

Get the numbers using a for loop and put them inside the array

Call the indexOfLargestElement method to find the index of the largest element in the array

You might be interested in
Students enrolled in a digital classroom participate in discussions and take field trips with classmates. watch instructional vi
krek1111 [17]

Answer:b

Explanation:gszrxewzgdtxherhzre

7 0
3 years ago
Cui documents must be reviewed to which procedures before destruction?
Aliun [14]

Answer:

Documents containing CUI must be destroyed by shredding..

Explanation:

Hope it helps you..

Your welcome in advance..

(ㆁωㆁ)

8 0
2 years ago
What is the LER for a rectangular wing with a span of 0.225m and a chord of 0.045m
ch4aika [34]

Calculate LER for a rectangular wing with a span of 0.225m and a chord of 0.045m. The weight of the glider is 0.0500 Newtons. (Note: the wing span is the width of the wing and is measured from wing tip to wing tip, or perpendicular to the fuselage. The wing chord is the length of the wing measured parallel or along the length of the fuselage.)

Answer:

Area of rectangular wing = span × chord = 0.225×0.045= 0.010125m2

LER = Area/weight = 0.010125/0.0500 = 0.2025

4 0
2 years ago
8.6 Lesson Practice edhesive
scoundrel [369]

Incomplete question. I could only infer you are possibly referring to edhesive unit 8 questions. Here are a few sample questions;

1. Where does Python start?

2. To create the body of a function, we ____________ the code.

Answer:

1. Main Section

2. Indent

Explanation:

1. It is a common rule in Python programming language when coding for for it to begin at the first part of the Main Section.

2. Indenting a code involves creating space or jumping a line away from the margin of the text dialogue box, thus the code written there becomes the body of the function.

8 0
3 years ago
How does a barcode work?
Genrish500 [490]
A barcode's bars have 

1. different thicknesses, so they each signify 1 or 2 nibbles. 
2. the combinations of the thicknesses of those bars exceed the trillions. That's why manufacturers and stores never run out of SKU barcodes.
4 0
2 years ago
Other questions:
  • Semiconductor memory is used mainly for primary storage even with its high cost. In another hand, the magnetic tape is the cheap
    6·1 answer
  • In three to five sentences, describe how technology helps business professionals to be more efficient. Include examples of hardw
    10·1 answer
  • .All of the following are true with the respect to implicitinvocation except:
    8·1 answer
  • Cloud resources are​ ________ because many different organizations use the same physical hardware.
    12·1 answer
  • You asked your colleague to provide feedback on a blog post you recently wrote. When they sent you their feedback, they made edi
    10·1 answer
  • Write a program that asks the user to input
    11·1 answer
  • Which of the following is true regarding the mod operator, %? Group of answer choices It can only be performed on int values and
    8·2 answers
  • Consider the following code segment.
    5·1 answer
  • The retention of encoded information over time refers to
    14·1 answer
  • Find out about the different technological solutions available for interconnecting LANs to from larger networks such as wide are
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!