Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Can someone please help me with this project for my Java Programming class? If you could correct my mistakes for me that would be great. 

Main.java X
1 package HP6_taylor;
2
30 import java.io.BufferedReader;
4 import java.io.FileReader;
5 import java.io.FileWriter;
6 import java.io.I0Exception;
7
8 public class Main {
9.
public static void main(String[] args) {
// TODO Auto-generated method stub
readwrite("words_for_homework(1).txt", "words_for_homework(1)Out.text");
}
public static void readwrite(String infile, String outfile) {
FileReader reader = null;
FileWriter writer = null;
try {
100
11
12
140
15
16
17
reader = new FileReader(infile);
writer = new FileWriter(outfile);
18
19
20
BufferedReader bufferedReader = new BufferedReader(reader);
String line;
while ((line = bufferedReader.readLine()) != null)
{
if (line.length() > 4)
{
21
22
23
24
25
26
27
if (line.substring(line.length()
4, line.length()).equalsIgnoreCase("dous"))
28
writer.write(line + '\n');
}
}
reader.close();
writer.close();
29
31
32
33
}
34
catch (I0Exception e){
e.printStackTrace();
35
36
37
38
O39 }
40
Problems
@ Javadoc E Declaration
Console X
<terminated> Main [Java Application] /Volumes/Eclipse/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at HP6_taylor.Main.main(Main.java:10)
N m st LO LO N
expand button
Transcribed Image Text:Main.java X 1 package HP6_taylor; 2 30 import java.io.BufferedReader; 4 import java.io.FileReader; 5 import java.io.FileWriter; 6 import java.io.I0Exception; 7 8 public class Main { 9. public static void main(String[] args) { // TODO Auto-generated method stub readwrite("words_for_homework(1).txt", "words_for_homework(1)Out.text"); } public static void readwrite(String infile, String outfile) { FileReader reader = null; FileWriter writer = null; try { 100 11 12 140 15 16 17 reader = new FileReader(infile); writer = new FileWriter(outfile); 18 19 20 BufferedReader bufferedReader = new BufferedReader(reader); String line; while ((line = bufferedReader.readLine()) != null) { if (line.length() > 4) { 21 22 23 24 25 26 27 if (line.substring(line.length() 4, line.length()).equalsIgnoreCase("dous")) 28 writer.write(line + '\n'); } } reader.close(); writer.close(); 29 31 32 33 } 34 catch (I0Exception e){ e.printStackTrace(); 35 36 37 38 O39 } 40 Problems @ Javadoc E Declaration Console X <terminated> Main [Java Application] /Volumes/Eclipse/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86 Exception in thread "main" java.lang.Error: Unresolved compilation problem: at HP6_taylor.Main.main(Main.java:10) N m st LO LO N
The following is an old word puzzle: "Name a common word, besides tremendous, stupendous and horrendous, that ends in dous."
We can also solve this puzzle by reading a text file of English words and outputting the word if it contains "dous" at the end. The text file
"words_for_homework.txt" contains 87314 English words, including the word that completes the puzzle.
Write a program that reads each word from the attached text file (words_for_homework.txt) and writes only those containing "dous" at the
end to another file. Below is a hint at the code to get at the dous. Include exception handling to catch any errors with the files. Use the
finally block to close the files. Zip the project folder and upload here.
Code Hint for -dous:
String line
br.readLine();
%3D
while (line != null)
{
if (line.length() > 4)
{
if (line.substring(line.length() - 4, line.length()).equalsIgnoreCase("dous"))
{
fw.write(line + "\n");
}
}
line = br.readLine();
}
expand button
Transcribed Image Text:The following is an old word puzzle: "Name a common word, besides tremendous, stupendous and horrendous, that ends in dous." We can also solve this puzzle by reading a text file of English words and outputting the word if it contains "dous" at the end. The text file "words_for_homework.txt" contains 87314 English words, including the word that completes the puzzle. Write a program that reads each word from the attached text file (words_for_homework.txt) and writes only those containing "dous" at the end to another file. Below is a hint at the code to get at the dous. Include exception handling to catch any errors with the files. Use the finally block to close the files. Zip the project folder and upload here. Code Hint for -dous: String line br.readLine(); %3D while (line != null) { if (line.length() > 4) { if (line.substring(line.length() - 4, line.length()).equalsIgnoreCase("dous")) { fw.write(line + "\n"); } } line = br.readLine(); }
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education