Question
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:
20 bins:
****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-0IStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started