Ask Question
6 December, 06:16

Write a static method named countLastDigits that accepts an array of integers as a parameter and examines its elements to determine how many end in 0, how many end in 1, how many end in 2 and so on. Your method will return an array of counters. The count of how many elements end in 0 should be stored in its element at index 0, how many of the values end in 1 should be stored in its element at index 1, and so on.

+4
Answers (1)
  1. 6 December, 07:32
    0
    See explaination for the program code

    Explanation:

    code:

    public static int[] countLastDigits (int[] list) {

    int[] count = new int[10];

    for (int i = 0; i < list. length; i++) {

    int digit = list[i] % 10;

    count[digit]++;

    }

    return count;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a static method named countLastDigits that accepts an array of integers as a parameter and examines its elements to determine how ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers