Using BufferedReader and FileReader..FileWriter?.. I have towrite a class with t
ID: 3616391 • Letter: U
Question
Using BufferedReader and FileReader..FileWriter?.. I have towrite a class with two methods:‘fillInRandom()’- should create a file called‘randomNums.txt’ filled with 100 random numbers, all ofwhich are between 1 and 20. There should be one number on eachline.
‘printFrequency()’ - determines how manytimes each number was present in the file, and displays theresult using a chart of stars. Inside this method, begin by readingin all of the values from the text file into an array of size 20.In other words, array[0] will keep track of the 1s, array[1]of the 2s, etc. Supopse to look somethign like this... 1: *******
2: *** 3: **** and so on... Using BufferedReader and FileReader..FileWriter?.. I have towrite a class with two methods:
‘fillInRandom()’- should create a file called‘randomNums.txt’ filled with 100 random numbers, all ofwhich are between 1 and 20. There should be one number on eachline.
‘printFrequency()’ - determines how manytimes each number was present in the file, and displays theresult using a chart of stars. Inside this method, begin by readingin all of the values from the text file into an array of size 20.In other words, array[0] will keep track of the 1s, array[1]of the 2s, etc. Supopse to look somethign like this... 1: *******
2: *** 3: **** and so on... Supopse to look somethign like this... 1: *******
2: *** 3: **** and so on...
Explanation / Answer
please rate-thanks import java.util.*; import java.io.*; public class bargraph {public static void main(String[] args)throwsFileNotFoundException {fillRandom(); printFrequency(); } public static void fillRandom()throws FileNotFoundException {int i; PrintStream output=new PrintStream(new File("randomNums.txt")); for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.