Wite a one-class java program with at least one method


According to Benford's law, in data in some large-enough numerical datasets, the first significant digit is 1 much more often than would be expected; in fact, 1 occurs as the first significant digit in the data almost 30% of the time, and 9 occurs less than 5% of the time. (We would expect each to occur one-ninth, or about 11%, of the time if each digit were equally likely to occur as the first significant digit.)

According to Benford's law, each digit occurs as the first significant digit in a dataset as follows:

1253_Write a one-class Java program.png

We want to computationally determine if the data in a given dataset follows Benford's law.

Input

The file data.txt, which contains our dataset as rows of numerical data., with each row representing one unit of data.

Output

The percentage of occurrence of each digit as the first significant digit in the data, represented both numerically and visually.

Your output should appear as follows:

1 (4.550%) : *****
2 (32.123%) : ********************************
3 (23.623%) : ************************
4 (8.322%) : ********
5 (3.484%) : ***
6 (10.008%) : **********
7 (7.555%) : ********
8 (1.892%) : **
9 (8.443%) : ********

Your percentages should be rounded off (up or down, depending on the decimal value) to an integer to determine the number of stars in your output for each significant digit.

Obviously, the above output suggests that the underlying data does not follow Benford's law.

Assignment

Write a one-class (Benford.java) Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law. Your program should generate output in the format given above. In a Word (DOCX) document, in no more than one or two sentences, state whether or not the data in your dataset more or less follows Benford's law and explain why you think so.

Name your project Benford. (This will be the name of the subdirectory of your workspace directory that will contain your source and object, or compiled, code.)

You will turn in the folder Benford (with all its files) and the Word document with your conclusions.


Attachment:- data.txt

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Wite a one-class java program with at least one method
Reference No:- TGS0658779

Expected delivery within 24 Hours