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
kkurt [141]
3 years ago
6

Write a program that uses an array of integers initialized to whatever values you wish. Write a methods to calculate and return

the minimum and a method to calculate and return the maximum values in the array. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same values as the original plus 10.
I think I have the max and min part down, but I need help figuring how to return the new array with all the same values as the orginal plus 10....

Here is what I have so far for the max / min. please use this in helping to create a matching method that accepts the array as a parameter. :

/*

*/
package arrayvalues;

/**
*
* @author dreadsguy
*/
public class ArrayValues {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int [] numbers = {99,56,103,9,31,63,81,92,13};

int m = maximum (numbers);
int n = minimum (numbers);


System.out.println("max ="+ m);
System.out.println("min ="+ n);


}


public static int maximum (int [] numbers){
//index
int i=0;
//current maximum
int max;
//initial maximum
max = numbers[i];
//calculate maximum

for (i = 1; i < numbers.length; i++){
if (numbers[i]> max)
{
max = numbers[i];
}

}
return(max);
}

public static int minimum (int [] numbers){
//index
int i=0;
//current minimum
int min;
//initial minimum
min = numbers[i];
//calculate minimum

for (i = 1; i < numbers.length; i++){
if (numbers[i]< min)
{
min = numbers[i];
}


}
return(min);
}
}
Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
6 0

Answer:

Here is the additional method you need to write:

<em>    public static int [] newArrayNumbers (int [] numbers){</em>

<em>    int [] newArray = new int[10];</em>

<em>    for (int i=0; i<numbers.length; i++){</em>

<em>        newArray[i]=numbers[i];</em>

<em>    }</em>

<em>    newArray[9]=10;</em>

<em>    return newArray;</em>

<em>    }</em>

The complete code is given in the explanation section

Explanation:

<em>import java.util.Arrays;</em>

<em>public class NewQues{</em>

<em>public static void main(String[] args) {</em>

<em>        int [] numbers = {99,56,103,9,31,63,81,92,13};</em>

<em>        int m = maximum (numbers);</em>

<em>        int n = minimum (numbers);</em>

<em>        System.out.println("max ="+ m);</em>

<em>        System.out.println("min ="+ n);</em>

<em>    System.out.println(Arrays.toString(newArrayNumbers(numbers)));</em>

<em> }</em>

<em>public static int maximum (int [] numbers){</em>

<em>        int i=0;</em>

<em>        int max;</em>

<em>        max = numbers[i];</em>

<em />

<em>        for (i = 1; i < numbers.length; i++){</em>

<em>        if (numbers[i]> max)</em>

<em>        {</em>

<em>        max = numbers[i];</em>

<em>        }</em>

<em>        }</em>

<em>        return(max);</em>

<em>        }</em>

<em>public static int minimum (int [] numbers){</em>

<em>        int i=0;</em>

<em>        int min;</em>

<em>        min = numbers[i];</em>

<em>        for (i = 1; i < numbers.length; i++){</em>

<em>        if (numbers[i]< min)</em>

<em>        {</em>

<em>        min = numbers[i];</em>

<em>        }</em>

<em>        }</em>

<em>        return(min);</em>

<em>        }</em>

<em>    public static int [] newArrayNumbers (int [] numbers){</em>

<em>    int [] newArray = new int[10];</em>

<em>    for (int i=0; i<numbers.length; i++){</em>

<em>        newArray[i]=numbers[i];</em>

<em>    }</em>

<em>    newArray[9]=10;</em>

<em>    return newArray;</em>

<em>    }</em>

<em>        }</em>

This for statement here does the work for you. assigning the values in the first array to the second array. <em>    </em>

<em>for (int i=0; i<numbers.length; i++){</em>

<em>        newArray[i]=numbers[i];</em>

<em>    }</em>

The second logic is, since you knew the first array had 9 elements, you create the second to have 10 elements so you can assign the element at the last index (9) the value of ten as required by the question

You might be interested in
What is a key function of a scrum master plato answer plz
sdas [7]
The scrum master is the team role responsible for ensuring the team lives agile values and principles and follows the processes and practices that the team agreed they would use.
6 0
3 years ago
To set up scenarios, you need to first use ______ to set up a list, then ______ to set up the reference cell. Last you need to u
Sholpan [36]

To set up scenarios, you need to first use Goal seek to set up a list, then data table  to set up the reference cell. Last you need to use  VLOOKUP to set up the cells that display the output results from the scenario.

<h3>What is a Goal Seek in Excel?</h3>

Microsoft Excel is known to have a goal seeking tool that is said to be built-in and it is one that gives room for the user to know the desired input value for any kind of  formula if the output value is said to be already known.

Hence, To set up scenarios, you need to first use Goal seek to set up a list, then data table  to set up the reference cell. Last you need to use  VLOOKUP to set up the cells that display the output results from the scenario.

See full question below

To set up scenarios, you need to first use to set up a list, then to set up the reference cell. Last you need to use to set up the cells that display the output results from the scenario. CHOOSE; VLOOKUP; data table Goal seek; data table; VLOOKUP Data validation; VLOOKUP; CHOOSE Data table; VLOOKUP;

Learn more about  VLOOKUP from

brainly.com/question/14042837

#SPJ1

6 0
2 years ago
In what domain electrica energy is the most use
amm1812

Answer:the main signal bearing entities are voltage and their current in circuit environments.

Explanation:

5 0
3 years ago
What color typically indicates the speaker port on a sound card?
allsm [11]
The answer to this question would be: Lime green

The lime green color code is for audio output for speaker or headphones. Color coding is greatly helpful to make sure that the port you are using is correct. Using the color you can determine what kind of input or output the port is for. There is a few others color coding like pink for analog microphone input, or light blue for audio input of analog line.
4 0
3 years ago
Read 2 more answers
You wish to enter your exam scores in a spreadsheet. Which function will help you find how each subject’s score relates to the o
KonstantinChe [14]

a is the correct answer

8 0
3 years ago
Read 2 more answers
Other questions:
  • Please use Python 3 to solve the following problem. Please also show all outputs and share code.The variable sentence stores a s
    6·1 answer
  • ___ are controls through which a user can enter input data in a gui application. answer
    10·1 answer
  • A coworker is concerned about the veracity of a claim because the sender of an email denies sending it. The coworker wants a way
    6·1 answer
  • What are the three primary separation of concerns on the client-side of a dynamic web application? (Check all that apply)
    13·1 answer
  • A subroutine may be used to refer to which of the following? Check all that apply.
    15·2 answers
  • Follow me on Tik-Tok​
    7·2 answers
  • Write, in your own words, a one-two paragraph summary on the Running Queries and Reports tutorials. Apply critical thinking and
    10·1 answer
  • Can maybe someone play with me on Over-watch on the Xbox?
    8·1 answer
  • Select all the items of the Design Elements.
    7·1 answer
  • How long will the plant have been dead when 87.5 percent of its C-14 has become N-14?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!