Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class MyAbstractProcess {
- public String[] readValues() {
- String y[] = {"1", "3", "9", "4", "7", "60", "0", "8", "2", "5"};
- return y;
- }
- public String action2() {
- String x[] = readValues();
- double total = 0;
- int max = Integer.parseInt(x[0]);
- int min = Integer.parseInt(x[0]);
- for (int i = 0; i < x.length; i++) {
- int currentNumber = Integer.parseInt(x[i]);
- total = total + currentNumber;
- if (max < currentNumber) {
- max = currentNumber;
- } else if (min > currentNumber) {
- min = currentNumber;
- }
- }
- double avg = total / x.length;
- return "avg" + avg + "max" + max + "min" + min;
- }
- public abstract int action();
- public void printValue() {
- System.out.println(action());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment