Topic: Designs of writing alphabets letter
July 17, 2019 / By Charlton Question:
Design a class Document with a state (attribute) String str. The constructor of this class accepts a file name as a passed parameter and then opens a text file and reads the text on that file onto the String str. This class contains set and get methods in addition to the following methods: Count, LetterOcc, WordLength, and WordOcc.
Count: Produces the following summary, depending on the passed arguments.
* How many sentences are in this text?
* How many words are in this text?
LetterOcc: Takes a string as an argument and prints a table indicating the number of occurrences of each letter of the alphabet in the text. For example, the sentence "Computer Science Department" contains one "a", three "c's", etc.
WordLength: Takes a string as an argument and prints a table indicating the number of one-letter words, two-letter words, three-letter words, etc. appearing in the text.
WordOcc: Takes a string as an argument and prints a table indicating the number of occurrences of each different word in the text.
Write a Driver class that creates a Document object and accesses its methods.
Alven | 1 day ago
Make a class name Document.
Provide a constructor, basically a method named Document without a return value.
Use input methods to get the file. Here is a tutorial on using input:
Here is a tutorial on how to make classes if that is what you need.
Use Eclipse IDE to run programs. I recommend it because it helps you focus on the program design rather than on the syntax (you learn syntax as you program). JDK is where you write the programs(such as Eclipse). You compile it by making sure you have JRE (java runtime environment)