Purchase Solution

Calculating Occurrences: Java Programming

Not what you're looking for?

Ask Custom Question

Need some assistance modifying attached code to meet/produce the following requirements/output:

Write a program that reads numbers from the keyboard into an array of type int[]. Assume that there will be 50 or fewer entries in the array. The program should allow any number of numbers to be entered, up to 50 numbers. The output is to be a two-column list. The first column is a list of the distinct array elements; the second column is the count of the number of the occurrences of each element. Sort the list on entries in the first column, largest to smallest. For example:

If the following elements are input into the array -12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -12

the output would be:

Num Count
4 2
3 3
2 2
1 4
-1 1
-12 4

Note: the columns should be properly spaced, as in my attached code, and there should be 1 column of numbers under each heading. Please use descriptive comments throughout so that I can understand what the code is doing.

Thank you for your assistance.

Purchase this Solution

Solution Summary

This solution provides a modified Java program that calculates occurrences.

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.