Question: Create a Java class with name: Assignment3 In the main() method do Create an array called array1 of length 100 with initial values {1, 2,
- Create a Java class with name: Assignment3
- In the main() method do
- Create an array called array1 of length 100 with initial values
{1, 2, , 100} using a for loop, and then calculate the sum of all the values in the array. Furthermore, display the sum.
- Create an array called array2 of length 10,000 with initial values
{1^2, 2^2, 3^2, , 100^2} using a for loop and the pow method in the built in Math class. Then calculate the sum of all the values in the array. Furthermore, display the sum.
- Use a for loop to assign the square roots of the integers from 1 to 1,000,000 to an array called array3. The compute the arithmetic average of all the numbers in array3. Moreover, display the average.
- Put the cubes of all the integers from 1 to 10 into a loop called array4, and then compute the geometric average of the integers in array4. Furthermore, display the final result.
Comments: should describe what your programs want to do. There are usually five types of comments on
- classes, telling what they do
- variables, telling their meanings
- methods, showing their purposes
- algorithms, describing their goals and key steps
- a piece of code, showing its purpose and key steps
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
