-type f -name '*.java') java -classpath.:target/dependency/* Main java.io.FileNotFoundException: /Users/justinmora/Downloads/ le.txt (No such file or directory) at java.base/java.io.FileInputStream.open@(Native Metho at java.base/java.io.FileInputStream.open(FileInputStre .java:216) at java.base/java.io.FileInputStream. (FileInputSt am.java:157) at java.base/java.util.Scanner.(Scanner.java:639) at Main.main(Main.java:9)
-type f -name '*.java') java -classpath.:target/dependency/* Main java.io.FileNotFoundException: /Users/justinmora/Downloads/ le.txt (No such file or directory) at java.base/java.io.FileInputStream.open@(Native Metho at java.base/java.io.FileInputStream.open(FileInputStre .java:216) at java.base/java.io.FileInputStream. (FileInputSt am.java:157) at java.base/java.util.Scanner.(Scanner.java:639) at Main.main(Main.java:9)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
i really need help with this java code, when i try to run it, an erros comes up

Transcribed Image Text:PP 8.3 Write a program that creates a histogram that allows
you to visually inspect the frequency distribution of a set of
values. The program should read in an arbitrary number of
integers from a text input file that are in the range 1 to 100
inclusive; then produce a chart similar to the one below that
indicates how many input values fell in the range 1 to 10, 11 to
20, and so on. Print one asterisk for each value entered.
1
- 10 | *****
11 - 20 | **
21 30
| **
31 - 40
I
41 - 50
| ***
51 - 60
| *****
61 - 70
| **
71 - 80
| *****
81 - 90 | **
91 100 **
-
-
file.txt.txt
1 2 3 4 5 6 14 12 13 16 26 24 54 35 36 45 46 56 58 69 69 79 79 91
![Main.java
Main.java
1 import java.io.File;
2 import java.io.FileNotFoundException;
ων
3 import java.util.Scanner;
5 public class Main {
8 69 S
6 ✓
7
8 v
9
10 v
11
2345678
12 v
13
14
15
L6
17
18 ✓
19
20
21
22
23
24 v
5 6 7 8 9
25
26
27
28 ✓
29
public static void main(String[] args) {
int[] range Counts = new int[10];
try {
Scanner scanner = new Scanner(new
File("/Users/justinmora/Downloads/file.txt"));
30
31
32
33 0 }
34 }
while (scanner.hasNextInt()) {
}
int value = scanner.nextInt();
if (value >= 1 && value <= 100) {
int range = (value - 1) / 10;
rangeCounts[range]++;
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
// Print the histogram
for (int i = 0; i < rangeCounts.length; i++) {
int startRange
i * 10 + 1;
int endRange = (i + 1) ⋆* 10;
}
=
System.out.printf("%2d-%2d: ", startRange, endRange);
for (int j = 0; j < rangeCounts[i]; j++) {
System.out.print("*");
System.out.println();
Console X
Shell x
> sh -c javac -classpath .:target/dependency/* -d . $(fi
-type f -name '*.java')
> java -classpath .:target/dependency/* Main
java.io.FileNotFoundException: /Users/justinmora/Downloads/fi
le.txt (No such file or directory)
at java.base/java.io.FileInputStream.open(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream
.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStre
.java:157)
at java.base/java.util.Scanner.<init>(Scanner.java:639)
at Main.main(Main.java:9)
am.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F13128d36-7a18-409b-baf9-4e9a58dc2e39%2Fe8b04637-8c2b-4920-8d33-951d4b4625e3%2Facn9zn_processed.png&w=3840&q=75)
Transcribed Image Text:Main.java
Main.java
1 import java.io.File;
2 import java.io.FileNotFoundException;
ων
3 import java.util.Scanner;
5 public class Main {
8 69 S
6 ✓
7
8 v
9
10 v
11
2345678
12 v
13
14
15
L6
17
18 ✓
19
20
21
22
23
24 v
5 6 7 8 9
25
26
27
28 ✓
29
public static void main(String[] args) {
int[] range Counts = new int[10];
try {
Scanner scanner = new Scanner(new
File("/Users/justinmora/Downloads/file.txt"));
30
31
32
33 0 }
34 }
while (scanner.hasNextInt()) {
}
int value = scanner.nextInt();
if (value >= 1 && value <= 100) {
int range = (value - 1) / 10;
rangeCounts[range]++;
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return;
// Print the histogram
for (int i = 0; i < rangeCounts.length; i++) {
int startRange
i * 10 + 1;
int endRange = (i + 1) ⋆* 10;
}
=
System.out.printf("%2d-%2d: ", startRange, endRange);
for (int j = 0; j < rangeCounts[i]; j++) {
System.out.print("*");
System.out.println();
Console X
Shell x
> sh -c javac -classpath .:target/dependency/* -d . $(fi
-type f -name '*.java')
> java -classpath .:target/dependency/* Main
java.io.FileNotFoundException: /Users/justinmora/Downloads/fi
le.txt (No such file or directory)
at java.base/java.io.FileInputStream.open(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream
.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStre
.java:157)
at java.base/java.util.Scanner.<init>(Scanner.java:639)
at Main.main(Main.java:9)
am.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education