Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please follow the steps to complete this guided assignment: Java please Define and instantiate an array of integers with ten elements. Fill in the array

Please follow the steps to complete this guided assignment: Java pleaseimage text in transcribed

  1. Define and instantiate an array of integers with ten elements.
  2. Fill in the array with integers from 1 to 100.
  3. To preserve the initial array, define another array named temp and copy the initial array in it.
  4. Define the variables you need to calculate the following values and initialize them with appropriate values.
  5. Perform the following tasks:
    • Print the original array.
    • Calculate the sum of all values.
    • Count the number of even values.
    • Calculate the minimum value in the array.
    • Calculate the maximum value in the array.
    • Replace the elements that are divisible by 3 with their value plus 2
    • Print the new array after replacement.
    • Display the calculated values.
  6. All tasks are listed in the template file, ArrayCommonOperations.txt. Download the template file and save it as ArrayCommonOperations.java.
  7. Go through the file, and identify the tasks you have to complete, which are clearly marked throughout the file. Complete all the required tasks.
  8. If all the required methods are implemented properly, the driver program should generate outputs similar to the following:

I am mostly stuck on task ten

public class ArrayCommonOperations {

public static void main(String [] args)

{

//*** Task #1: Define and instantiate an array of integer numbers, with 10 elements

//*** Task #2: Fill in the array with integer numbers from 1 to 100

//*** Task #3: define another array, named temp, and copy the initial array in it.

//* This allows to preserve the original array

//*** Task #4: Define the variables you need to calculate the following values

,//* and initialize them with appropriate values

.//*** Task #5: Print the original array

//*** Task #6: Calculate the sum of all values

//*** Task #7: Count the number of even values

//*** Task #8: Calculate the minimum value in the array

//*** Task #9: Calculate the maximum value in the array

//*** Task #10: Replace the elements that are divisible by 3, with their value plus 2

//*** Task #11: Display the new array after replacement

//*** Task #12: Display the calculated values.}}

66 28 5 24 68 28 5 26 The original array has the following values: 47 21 57 51 75 65 The original array has the following values: 47 23 59 53 77 65 Sum of values in the array: 439 Count of even values in the array: 3 Minimum value in the array: 5 Maximum value in the array: 75 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

1.The difference between climate and weather?

Answered: 1 week ago

Question

1. What is Fog ?

Answered: 1 week ago

Question

How water vapour forms ?

Answered: 1 week ago

Question

What is Entrepreneur?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago