Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

https://drive.google.com/file/d/1WE59HGfdLZcqjUHoItICrUbtipw8b-L4/view?usp=sharing NOTE: DO WITHOUT USING ARRAYLIST Write a single Java class that, when run as a console program in a directory containing a properly formatted

https://drive.google.com/file/d/1WE59HGfdLZcqjUHoItICrUbtipw8b-L4/view?usp=sharing

NOTE: DO WITHOUT USING ARRAYLIST

Write a single Java class that, when run as a console program in a directory containing a properly formatted grades file (more below), prints a histogram of the grade distribution to STDOUT (the console). Name your class Histogram and save its source code in an appropriately named file. A histogram is a graphical representation of a sequence of bins which represent ranges of values. Each bin contains a number which represents the number of occurrences of data points that lie within the range of values represented by the bin. Your program will take two inputs (more later): the name of a data file and the number of bins to create in the histogram. You will represent these bins as elements of an array and your program will count the number of occurrences of values from the data file that lie within the ranges represented by each bin. The data values will lie in the range [0, 100]. For example, if we had a data file with these contents: Dead Starks, 6 Dead Lannisters, 3 Luftballons, 99 and you create a histogram with two bins, the array to represent the bins would contain [2, 1], where the first element of the array contains the count of values in the interval [0, 50] and the second element contains the count of values in [51, 100]. After counting the number of grades in each bin, your program will print a horizontal histogram. You must also label the range of each bin, which can be derived from the number of bins and the range of data values. Each bin should have the same sized range except if the number of bins does not divide 101 evenly, the extra should be included in the lowest bin.

The Histogram should look something like this:

10 bins:

image text in transcribed

20 bins:

image text in transcribed

****The spacing here is very important. You must use the same spacing scheme as our examples or you will lose points. Also make sure the prompt for the number of bins is the same as our example.

We have provided you with a CSV file that has a list of students and their grades. A CSV file is just a text file with data partitioned by commas and (in this case) newlines. Note that there may be any number of spaces surrounding the comma. These grades are not sorted but they are integers bound between 0 and 100 (inclusive).

For example, the file may look like:

Glenn Hollingsworth,91

Thomas Shields, 89

Bob,55

Alice,95

Eve, 87

You will use command-line arguments to inform your program the location of the grades file - see Expected Output for how to pass the file name in when running the program. You must allow the user to specify the number of bins in the two following ways: Firstly, the number of bins may be specified as an additional command line arg, e.g. java Histogram grades.csv 5 If the second command line arg is not present, your program must ask the user for the number of bins at the beginning.

$java Histogram grades.csv How many bins would you like? 10 100 91 I 90 81 ii 80 71 ii 70 61 60 51 i 50 41 I 40 31 30 21 | [1 20 11I 10-0I

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

=+ What topics are contained in the contracts?

Answered: 1 week ago

Question

=+Are they specific or general in nature?

Answered: 1 week ago

Question

=+ What is the nature of the contracts or agreements with unions?

Answered: 1 week ago