First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).Then create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines.** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the first character of the parameter is a letter. If it is not a letter, the method throws an Exception of type Exception with the message of: "This is not a word." void checkWord(String word) throws Exception Write a complete Java method called getWord that takes no parameters and returns a String. The method prompts the user for a word, and then calls the checkWord method you wrote in #1 above, passing as a parameter the word the user provided as input. Make sure the getWord method handles the Exception that may be thrown by checkWord. String getWord() Write a complete Java method called writeFile that takes two parameters: an array of Strings (arrayToWrite) and a String (filename). The method writes the Strings in the arrayToWrite array to a text file called filename (the parameter), with each String on a separate line. void writeFile(String[] arrayToWrite, String filename) Write a complete Java method called readFile that takes a String as a parameter (filename) and returns an ArrayList of Strings (fileContents). The method reads the text file identified by the filename parameter and populates the ArrayList with an element for each line in the text file. String[] readFile(String filename) In your main method, do the following in the order specified: Call the getWord method you wrote in #2 above and print the result to the command line.Create an array of Strings called testData and populate it with at least three elements.Call the writeFile method you wrote in #3 above passing the array you created in #5.2 and the String "data.txt".Call the readFile method you wrote in #4 above to read the file you wrote in #5.3. Assign the result of readFile to an ArrayList variable in main called fileContents.Write a loop to print the contents of the fileContents ArrayList to the command line.

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
icon
Related questions
Question
100%

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines.

** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. **

Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the first character of the parameter is a letter. If it is not a letter, the method throws an Exception of type Exception with the message of: "This is not a word." void checkWord(String word) throws Exception
Write a complete Java method called getWord that takes no parameters and returns a String. The method prompts the user for a word, and then calls the checkWord method you wrote in #1 above, passing as a parameter the word the user provided as input. Make sure the getWord method handles the Exception that may be thrown by checkWord. String getWord()
Write a complete Java method called writeFile that takes two parameters: an array of Strings (arrayToWrite) and a String (filename). The method writes the Strings in the arrayToWrite array to a text file called filename (the parameter), with each String on a separate line. void writeFile(String[] arrayToWrite, String filename)
Write a complete Java method called readFile that takes a String as a parameter (filename) and returns an ArrayList of Strings (fileContents). The method reads the text file identified by the filename parameter and populates the ArrayList with an element for each line in the text file. String[] readFile(String filename)
In your main method, do the following in the order specified:
Call the getWord method you wrote in #2 above and print the result to the command line.
Create an array of Strings called testData and populate it with at least three elements.
Call the writeFile method you wrote in #3 above passing the array you created in #5.2 and the String "data.txt".
Call the readFile method you wrote in #4 above to read the file you wrote in #5.3. Assign the result of readFile to an ArrayList variable in main called fileContents.
Write a loop to print the contents of the fileContents ArrayList to the command line.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Exception Handling Keywords
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
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education