Write a one-class java program

Assignment Help JAVA Programming
Reference no: EM13320107

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

Reference no: EM13320107

Questions Cloud

Determine the electric potential energy of the system : Three equal charges of magnitude +4.00 uC are placed at the corners of an equilateral triangle of side 2 cm. what is the electric potential energy of the system
What is the energy of the electromagnetic radiation : An electron and a positron have masses of 9.11 10-31 kg. They collide and both vanish, What is the energy of the electromagnetic radiation
How tall is the resulting image : If a lens with focal length 10 cm is placed 30 cm from an image 3 cm tall, and a cecond lens with focal length -15 cm is placed 36 cm from the image. how tall is the resulting image
Find the ratio of the particle masses : A head-on, elastic collision between two particles with equal initial speed vleaves the more massive particle (massm1) at rest. Find the ratio of the particle masses
Write a one-class java program : Write a one-class 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.
What will be the time constant of voltage decay : Draw a circuit for two resistors R1 and R2 in series, in parallel with a third resistor R3 in series with a capacitor C1. What will be the time constant of voltage decay
How fast would the particle be traveling : An alpha particle (doubly ionized He atom ) is created in a vacuum in the center between our pair of Helmholtz coils horizontal (in the xy plane), how fast would the particle be traveling
Define design storm specified for an urban area in tennessee : For a design storm specified for an urban area in Tennessee, the depth of rainfall is 2.5 inches (6.35 cm). Initial abstraction in depressions on the pervious and impervious areas was estimated at 0.5 inches (1.27 cm).
At what angle will the first order diffrection angle be : If a red laser light (He-Ne Laser) with a wavelength of 633 nm and a frequency of 4.739 *10^14 Hz, at what angle will the first order diffrection angle be

Reviews

Write a Review

JAVA Programming Questions & Answers

  The ai player will not be asking

The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them

  Write a program in java that simulates a simple line editor

Write a program in Java that simulates a simple line editor which supports the following operations

  Graphics program that draws 12 strings

Write a graphics program that draws 12 strings, one each for the 12 standard colors, besides Color.WHITE, each in its own color. Provide a class ColorNameViewer and a class ColorNameComponent.

  Write a java that reads from the user annual income

Write a Java program (name it IncomeTax) that reads from the user annual income as  integer value.

  Java program to read line of text which ends with period

Write down the java program which will read the line of text which ends with the period, which serves as sentinel value. Show all the letters which occur in the text.

  Write a java program that prints the numbers from 1 to 125

Write a Java Program that prints the numbers from 1 to 125. But for multiles of three print "Batman" instead of the number and for the multiples of five print "Superman". For instances which are multiples of both three and five "JusticeLeague".

  Write a method called add uneven arrays

Write a method called addUnevenArrays that takes two arrays, a and b, and returns a new array, c, with alength that is the maximum of the lengths of a and b. Each c[i] is the sum of the corresponding elementsof a and b if both elements exist.

  Given a sequence of 10 integers

Write a program given that given a sequence of 10 integers, find out and delete the maximum and minimum number, then compute the average of the rest.

  Overriding the equals method

Use the equals method, which Player inherits from the Object class, to determine whether two players are the same. Are the results what you expect?

  Write a recursive method to reverse a string.

write a recursive method to reverse a string. Explain why you would not normally use recursion to solve this problem?

  Application that simulates a cash register

Implement a graphical application that simulates a cash register. Provide a text field for the item price and two buttons for adding the item to the sale, one for taxable items and one for nontaxable items. In a text area, display the register tap..

  Create a file that contains your favorite movie quote

Create a file that contains your favorite movie quote. Use a text editor such as Notepad, and save the file as quote.txt. Copy the file contents,

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd