plz provide a screenshot of your code, once it finished. Thank you! Image one is the file I use, u can also creat your own file as long as it's similar to mine. image two is my program, base on my program I want to write a 4th method(method 4) the spec for method 4 are: A method to count the occurrences of each value in an array takes one parameter, an array of integers returns an array containing the number of times each value occurs in the parameter array should call method 3 from method 4 too.(Hint: this call will pass the array of counts produced by method 4.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

plz provide a screenshot of your code, once it finished. Thank you!
Image one is the file I use, u can also creat your own file as long as it's similar to mine.

image two is my program, base on my program I want to write a 4th method(method 4)

the spec for method 4 are:

A method to count the occurrences of each value in an array

    • takes one parameter, an array of integers

    • returns an array containing the number of times each value occurs in the parameter array

    • should call method 3 from method 4 too.(Hint: this call will pass the array of counts produced by method 4.
1 29//totol value in this file.
25
35
4 5
55
65
73
85
95
10 5
11 3
12 5
13 5
14 5
15 4
16 5
17 2
18 5
19 5
20 5
21 5
22 4
23 5
24 5
25 5
26 5
27 5
28 4
29 5
30 5
Transcribed Image Text:1 29//totol value in this file. 25 35 4 5 55 65 73 85 95 10 5 11 3 12 5 13 5 14 5 15 4 16 5 17 2 18 5 19 5 20 5 21 5 22 4 23 5 24 5 25 5 26 5 27 5 28 4 29 5 30 5
1 import java.util.*;
2 import java.io.*;
3 public class FunWithHistograms {
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
£ £ £ £ £ £ E B G D E ~~~~~~
23
24
25
26
27
28
30
33
34
35
37
38
39
40
41
42
43
44
45
46 }
public static void main(String[] args) throws FileNotFoundException {
printIntro();//method 1
}
}
public static void printIntro () {
System.out.println("The program will analyze data from a dataset of");
integer values. It will produce a");
System.out.println("non-negative
System.out.println("histogram of the data and output some statistics.");
System.out.println();
Scanner console = new Scanner (System.in);
System.out.print("input file name? ");
String fileName = console.nextLine();
Scanner inFile = new Scanner (new File(fileName));
}
int[] data = readData(inFile); //method 2
public static int[] readData (Scanner inFile) { //method 2
int numVals = inFile.nextInt ();
int[] data = new int[numVals];
}
for (int i = 0; i < numVals; i++) {
data[i] = inFile.nextInt ();
}
return data;
//method 3.
public static int findMax (int[] data) {
int maxValue = data[0];
for(int i = 0; i <data.length; i++) {
if(maxValue <data[i]) {
maxValue = data[i];
}
}
return maxValue;
//write method 4 plz
历史记
下载内
书签
缩放
JEP...
...
...
更多工
编辑
设置
帮助
Transcribed Image Text:1 import java.util.*; 2 import java.io.*; 3 public class FunWithHistograms { 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 £ £ £ £ £ £ E B G D E ~~~~~~ 23 24 25 26 27 28 30 33 34 35 37 38 39 40 41 42 43 44 45 46 } public static void main(String[] args) throws FileNotFoundException { printIntro();//method 1 } } public static void printIntro () { System.out.println("The program will analyze data from a dataset of"); integer values. It will produce a"); System.out.println("non-negative System.out.println("histogram of the data and output some statistics."); System.out.println(); Scanner console = new Scanner (System.in); System.out.print("input file name? "); String fileName = console.nextLine(); Scanner inFile = new Scanner (new File(fileName)); } int[] data = readData(inFile); //method 2 public static int[] readData (Scanner inFile) { //method 2 int numVals = inFile.nextInt (); int[] data = new int[numVals]; } for (int i = 0; i < numVals; i++) { data[i] = inFile.nextInt (); } return data; //method 3. public static int findMax (int[] data) { int maxValue = data[0]; for(int i = 0; i <data.length; i++) { if(maxValue <data[i]) { maxValue = data[i]; } } return maxValue; //write method 4 plz 历史记 下载内 书签 缩放 JEP... ... ... 更多工 编辑 设置 帮助
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY