logo Practice-It logo


Language/Type: Java arrays tallying
Author: Marty Stepp

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.

For example, if an array named list contains the values {9, 29, 44, 103, 2, 52, 12, 12, 76, 35, 20}, the call of countLastDigits(list) should return the array {1, 0, 4, 1, 1, 1, 1, 0, 0, 2} because 1 element ends with 0 (20), no elements end with 1, 4 elements end with 2 (2, 52, 12, and 12), etc.

Type your solution here:

This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.