Problem 1:
—————————————————————————————————————-
/*
* Code written in java
* Just copy and paste the code to run
*/
public class Problem1 {
public static void main(String[] args) {
//create an array of 20 integers
int a[] = {20, -2, 30, -7, 89, -23, 50, 60, 70, 10, -9, -56, 4, -3, 78, 1001, 54, -10, 44, -21};
System.out.println(“Content of arrays is : “);
for(int i=0; i max)
max = a[i];
if(a[i] = 0)
countPos ++;
}
System.out.println(“Percentage of positive integers is ” + (countPos*100)/20 + “%”);
}
}
Problem 2:
—————————————————————————————————————-
/*
* Code written in java
* Just copy and paste the code to run
*/
import java.util.ArrayList;
import java.util.Random;
public class Problem2 {
public static void main(String[] args) {
//create an array of 50 integers
int a[] = new int[50];
//initialize the array with random integers
Random rand = new Random();
for(int i=0; i even = new ArrayList();
for(int i=0; i max)
max = a[i];
if(a[i] prime = new ArrayList();
for(int i=0; i
“Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!”
What Students Are Saying About Us
.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"
.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."