Question: Part 1- Method practice Create a main method. In there, make an array of 100 random integers(numbers between 0 and 1000). Create a static method

Part 1- Method practice

  1. Create a main method. In there, make an array of 100 random integers(numbers between 0 and 1000).
  2. Create a static method to find average of the array. Pass the array and return the number(double) that is the average
  3. In the main method, call the method created in Step 2. Print out the average
  4. Create a method to find the min value of the array. Pass the array and return the int that is the smallest.(pass the value not the index of the value)
  5. In the main method call the method made in Step 4. Print out the minimum
  6. In the main method print out the first and last value of the array created in step 1
  7. Create a method to return a new array that is the reverse of the array created in step 1. Return the new array
  8. In the main call the method done in step 7. In the main print out the first and last value of the returned array.
  9. In the main method, make an array of Strings called shoppingList. It should contain {soda,corn,beans,chips,apples}
  10. Create another method called reverse that is an overloaded version of method created in 7. This one takes an array of Strings but the code to reverse should be the same. Remember an overloaded method has the same name, it just changes the parameters( in this case the return type is changed too). So the method header would

public static String [] reverse(String[] a)

  1. Make a new method called averageEvenIndexes that averages the even index values. It would return a double that represents the average of the values located in the even indexes. This means you have to sum the even index values and count how many there are. Then use these two values to compute and average and return it. Add to the main method where you call this method and print out the returned value

Output should look like

The average of array is 513.44

The minimum of array is 28

The first value is 457 , the last value is 826

After reverse, first value is 826 , the new last value is 457

In shoppingList, the first value is soda, the last value is apples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!