Class: Java
Book: Introduction To Java Programming 10th Edition, Comprehensive by Daniel Liang
Problem:
****** Parse the text file by splitting on "[ \n\t\r.,;:!?(){}<>\"]", that is call the split method with this parameter: For example, call contents.split("[ \n\t\r.,;:!?(){}<>\"]"), where contents is a String object containing the contents of the text file.
Also, explain (in the comment block at the beginning of the source file) two other approaches that could have been taken for the problem (use of other data structures, perhaps?) and why you chose the approach you took as opposed to the alternatives. Compare and contrast your approach relative to these other approaches in terms of coding complexity, performance, and memory usage. ******

import java.util.*;
import java.io.*;
public class Exercise_21_02 {
public static void main(String[] args) throws
Exception {
// Check length of
command-line argument
if (args.length != 1)
{
System.out.println("Usage: java fileName");
System.exit(1);
}
// Check if file
exists
File textFile = new
File(args[0]);
if (!textFile.exists())
{
System.out.println("The file " + args[0] + " does not
exist.");
System.exit(2);
}
// Create a set
TreeSet<String>
set = new TreeSet<>();
// Read nonduplicate
words from the file
try ( // Create an input
file
Scanner input = new Scanner(textFile);
) {
while (input.hasNext()) {
String[] words = input.nextLine().split("[
\n\t\r.,;:!?()-]");
for (String word: words) {
if (word.length() > 0)
set.add(word.toLowerCase());
}
}
}
// Display
nonduplicate word in ascending order
System.out.println(set);
}
}
Class: Java Book: Introduction To Java Programming 10th Edition, Comprehensive by Daniel Liang Problem: ****** Parse...
Chapter 7 Exercise 18, Introduction to Java
Programming, Tenth Edition Y. Daniel Liang. Please write
your own code.
7.18 (Bubble sort) Write a sort method that uses the bubble-sort
algorithm. The bubblesort algorithm makes several passes through
the array. On each pass, successive neighboring pairs are compared.
If a pair is not in order, its values are swapped; otherwise, the
values remain unchanged. The technique is called a bubble sort or
sinking sort because the smaller values gradually “bubble” their...
CSC110
Lab 6 (ALL CODING IN JAVA)
Problem: A text file contains a paragraph. You are to read the
contents of the file, store the UNIQUEwords and count the
occurrences of each unique word. When the file is completely read,
write the words and the number of occurrences to a text file. The
output should be the words in ALPHABETICAL order along with the
number of times they occur and the number of syllables. Then write
the following statistics to...
You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...
Hi there! I need to compare two essay into 1 essay, and make it interesting and choose couple topics which im going to talk about in my essay FIRST ESSAY “Teaching New Worlds/New Words” bell hooks Like desire, language disrupts, refuses to be contained within boundaries. It speaks itself against our will, in words and thoughts that intrude, even violate the most private spaces of mind and body. It was in my first year of college that I read Adrienne...