Write a program in Java to read 5 integers and print their sum and average.

Discuss the key issues in project portfolio management and how each of them could present a challenge to the organization.
August 4, 2017
Explain the factors that contribute to domestic violence and use this information to analyze Trifles, explaining what might have driven Minnie to murder her husband.
August 4, 2017
Show all

Write a program in Java to read 5 integers and print their sum and average.

Question One
Write a program in Java to read 5 integers and print their sum and average. Use loop statements in your code. The output of your program looks like:

Question Two
Write a program in Java to read 5 integers and print and print the minimum and maximum values .Use while loop and if statements in your code. The output of your program looks like:

Question Three
What is the value of m after running the following code?
int[] m = new int[8];
m[0] = 1;
for (int i = 1; i < m.length; i++) {
m[i] = m[i-1] + i;
}
Question Four

Find and fix the error in each of the following codes:

1.
int[ ] a = new int[ 60 ];
for( int h = 0; h <= a.length; h++ )
a[ h ] = 1;

2.
ArrayList m = new ArrayList();
m.add(1);
m.add(2);
m.remove(0);

Leave a Reply

Your email address will not be published. Required fields are marked *