import [Link].
ArrayList;
import [Link];
import [Link];
public class ArrayHomework2 {
public static void main(String[] args) {
}
public static void PrintDistinctNum() {
int[] TenNum = {1, 2, 3, 2, 1, 6, 3, 4, 5, 2};
int[] DistinctNum = new int[10];
int count = 0;
for (int i = 0; i < [Link]; i++) {
boolean isDistinct = true;
for (int j = 0; j < i; j++) {
if (TenNum[j] == TenNum[i]) {
isDistinct = false;
break;
}
}
if (isDistinct) {
DistinctNum[count] = TenNum[i];
count++;
}
}
int[] distinctNumbers = [Link](DistinctNum,
count);
[Link]([Link](distinctNumbers));
}
public static void AnalyzeScores() {
Scanner scan = new Scanner([Link]);
ArrayList<Integer> Score = new ArrayList<>();
[Link]("Enter scores (enter -1 to
stop):");
int input = [Link]();
while (input != -1) {
[Link](input);
input = [Link]();
//int[] Score = {100, 90, 80, 60, 50, 69, 120, 100};
int sum = 0;
for (int j : Score) {
sum += j;
}
int Avg = sum/([Link]()-1);
int AboveOrEqualAvg = 0;
int BelowAvg = 0;
for (int j : Score) {
if (j >= Avg) {
AboveOrEqualAvg++;
} else {
BelowAvg++;
}
[Link](AboveOrEqualAvg + " numbers are
above or equal to average");
[Link](BelowAvg + " numbers are below
average");
public static void RandomInt () {
int[] numbers = new int[10];
for (int i = 0; i < 100; i++) {
int random = (int) ([Link]() * 10);
numbers[random]++;
[Link]([Link](numbers));
}
public static void CountOccurance() {
Scanner scan = new Scanner([Link]);
ArrayList<Integer> count = new ArrayList<>();
[Link]("Enter the integers between 1
and 100 (input 0 to stop):");
int input = [Link]();
while (input != -0) {
[Link](input);
input = [Link]();
}
[Link](count);
int[] occurance = new int[100];
int length = [Link]();
for (int i = 0; i < length; i++) {
for (int j = 0; j < [Link]; j++) {
if ([Link](i) == j) {
occurance[j]++;
}
}
for (int i = 0; i < [Link]; i++) {
if (occurance[i] == 1) {
[Link]("The number " + i + "
occured " + occurance[i] + " time");
}
else if (occurance[i] != 0) {
[Link]("The number " + i + "
occured " + occurance[i] + " times");
}
}
}