Graderpractice for programmers

254275 OOP - Arrays (Extra Lab B) Arrays

Awaiting submission

Write a method to the sum of an array of integers.

Template

class TaskA {

    public static void main(String[] args) {
        int[] numbers = Input.intArray();
        int result = sum(numbers);
        System.out.println(result);
    }

    public static int sum(int[] numbers) {
        // TODO: Your answer here
    }

}

You will require Input.java for easy array input.

Awaiting submission

Given an array of strings, return the first word that is longer than 6 letters. If no such word is found then print nothing.

Template

class TaskB {

    public static void main(String[] args) {
        String[] words = Input.stringArray();
        String result = longWord(words);
        System.out.println(result);
    }

    // TODO: Your answer here
}
Awaiting submission
Given an array of integers, return true if all integers in the array are equal.
Awaiting submission
Given an array of integers, return true if the sequence of numbers 1, 2, 3 appears anywhere in the array.
Awaiting submission
Given an array of strings, return all the words that are longer than 6 letters. Print one per line.
Awaiting submission
Given an array of integers, return an array where any odd numbers of the input array are changed to the nearest lower even number. (Odd numbers decremented by 1.)
Awaiting submission
Given a list of coordinates, draw a grid of dots with an x for every coordinate. The grid should be the smallest square that can accommodate all the coordinates.
Awaiting submission
Find the common strings between two arrays. Print the results sorted (a-z).
Awaiting submission
Given an array of integers, return an array with the duplicates removed.