InClass Assignment 17 Exercise A Write a java console progra

In-Class Assignment #17

Exercise A:

Write a java console program ArrayMethod.

Ask the user to enter the size of the array. Then fill your array with that many numbers.

Printout the array the way user entered.

Print the sum of all the numbers (you must write the separate method Sum)

Print the average. Must calculate the average in the main by calling the Sum method and length method. Print up to 2 decimal points.

Print the Max number.  (you must write the separate method Max)

Print the Min number.  (you must write the separate method Min)

Print the difference of Max and Min number in main by calling Max and Min method.

At last, you must print the sorted array. (you must write a separate method SortedArray)

Exercise B:

Write a program, MatchingArray, that contains an array of five names and another array of five passwords(your choice). Your program should ask the user to enter a name and password. If the user enters the correct name with it\'s related password , Printout ..It\'s a match. If the user enters the wrong name/password (can be either or both), Print the message..It\'s not a match.

Note: In your array, first name should match with your first password. Second name should match with your second password...etc..

Exercise C:

Write a program, TwoDimentionalGrid.

Ask the user to enter the size of the 2 dimensional array. Create a 2D array with the same row and column number. Now print the array.

Example:

Please enter the size of the array: 5

Here is the output:

1 2 3 4 5

2 4 6 8 10

3 6 9 12 15

4 8 12 16 20

5 10 15 20 25

Exercise D:

Write a program DeletingAnArrayElement.

Declare an array of type int. int [] myArray ={45, 38, 27, 46, 81, 72,56, 61, 20, 48, 76, 91, 57, 35,78};

Print the array to the console and ask the user which number s/he wants to delete?

Example:

Here is your array!

45 38 27 46 81 72 56 61 20 48 76 91 57 35 78

Which number you want to delete? 27

The number found at index 2.

Now the new array is:  45 38 46 81 72 56 61 20 48 76 91 57 35 78

Solution

average= sum/10;

In-Class Assignment #17 Exercise A: Write a java console program ArrayMethod. Ask the user to enter the size of the array. Then fill your array with that many n
In-Class Assignment #17 Exercise A: Write a java console program ArrayMethod. Ask the user to enter the size of the array. Then fill your array with that many n

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site