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 happens it the offshore team members are not able to participate in the iteration demo due to time zone/infrastructure issu
professor190 [17]

The best option that will suite is that there will be no major issues since the offshore leads and the onsite members participated in the demo with the Product Owner/Stakeholders they can cascade the feedback to the offshore members

Explanation:

Iteration demo is the review which is done to gather the immediate feedback from the stakeholders on a regular basis from the regular cadence. This demo will be one mainly to review the progress of the team and the and to cascade and show their working process

They show their working process to the owners and they and the other stakeholders and they get their review from them and so there will be no issues if the members are not able to participate

5 0
4 years ago
What is the relationship between interoperability and the other quality attributes highlighted in this book? For example, if two
Lina20 [59]

Answer:

Interoperability is the ability of or degree to which two or more systems usefully exchange information via interfaces in particular context. Interoperability can be defined in two ways which includes the ability to exchange data (syntactic interoperability) and also the ability to correctly interpret the data being exchanged (semantic interoperability).

If two systems failed to exchange information properly, it means they are not clear to interpret and not easy to communicate and get proper information from each other and that might result in a failed communication which is in turn result in security flaw.

Other quality attributes strongly related (at least potentially) to interoperability is Application Programming Interface (API)

API is a software intermediary that allows two applications to communicate to each other and are necessary for systems interoperability.

8 0
3 years ago
How does microsoft label mac addresses in the windows utilities that show you the mac address?
statuscvo [17]

Based on computer analysis, Microsoft labels mac addresses in the windows utilities "<u>by showing the MAC address in the 'Physical Address' field."</u>

<h3>What is MAC Address?</h3>

MAC Address is the acronym for media access control address. A distinct identifier is allocated to a network interface controller (NIC).

MAC address is used as a network address in communications within a network component.

There are two ways to check for a MAC address in the Windows Utilities which is either through Command Prompt or Network Setting.

Hence, in this case, it is concluded that the correct answer is "<u>by showing the MAC address in the 'Physical Address' field."</u>

Learn more about MAC Address here: brainly.com/question/24812654

6 0
2 years ago
A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser.
FrozenT [24]
That is false. are you doing it on a computer course.                                             <span />
3 0
3 years ago
Read 2 more answers
Write a python program to accept a number and check whether it is divisible by 4 or not​
Alenkasestr [34]

Answer:

number = int(input("Enter number: "))

if (number % 4):

 print("{} is not divisible by 4".format(number))

else:

 print("{} is divisible by 4".format(number))

Explanation:

If the %4 operation returns a non-zero number, there is a remainder and thus the number is not divisable by 4.

5 0
2 years ago
Other questions:
  • What two images did you have to add to the wds server to handle the windows installation?
    7·1 answer
  • The maximum number of colors that should be used on a slide is _____. 2 4 6 8
    12·2 answers
  • For conditional formatting, a formula must be in the form of a(n) _____ test that results in a true or false value. Question 1 o
    8·1 answer
  • Why is the keyboard arranged in the QWERTY style?
    6·2 answers
  • How would a designer interpret the word denier?
    12·2 answers
  • Discuss how the accessibility of television has changed over time
    7·1 answer
  • -Define three types of user mode to kernel mode transfers?
    11·1 answer
  • 8.2 Code Practice Edhesive
    6·1 answer
  • Lindsey also needs to calcite the commissions earned each month. If the company earns $200,000 or more in a month, the commissio
    5·1 answer
  • Identify 5 products/services needed by the people in our current situation.<br>​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!