Write each of these methods in the Unit7ProblemSet.java class.
When you are finished, zip the Unit7ProblemSet Netbeans folder and submit to the dropbox.
To create a .zip file in Windows, right-click on the folder and select Send to - Compressed (zipped) folder.
On the Mac, use the Compress option in the Finder.
** 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 **
1. 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 "This is not a word." (2 points)
2. 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.(2 points)
3. 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. (2 points)
4. 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. (2 points)
5. Do the following in the Unit7ProblemSet.java main method (hint: the order is important):
5.1 Call the getWord method you wrote in #2 above and print the result to the command line.
5.2 Create an array of Strings called testData and populate it with at least three elements.
5.3 Call the writeFile method you wrote in #3 passing the array you created in #5.2 and the String "data.txt".
5.4 Call the readFile method you in #4 to read the file you wrote in 5.3.
Assign the result of readFile to an ArrayList variable in main called fileContents.
5.5 Write a loop to print the contents of the fileContents ArrayList to the command line.
This question was answered on: Jan 30, 2021
Buy this answer for only: $15
This attachment is locked
We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)
Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
About this QuestionSTATUS
Jan 30, 2021EXPERT
GET INSTANT HELP/h4>
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions:
- As a reference for in-depth understanding of the subject.
- As a source of ideas / reasoning for your own research (if properly referenced)
- For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
NEW ASSIGNMENT HELP?
Order New Solution. Quick Turnaround
Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.
WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.