Write a complete java method called checkword

Assignment Help Financial Accounting
Reference no: EM13901074

Basic Java** 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. 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.

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. 

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.

5. Do the following in the 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.

Reference no: EM13901074

Questions Cloud

When we apply gauss''s law in a dielectric medium : An electric field is given by -E = 10-a x + 20a-y + 20a-z V/m. Is this a uniform field? Why? What is its magnitude? What are the cosines of the angles it makes with the unit vectors?
Pay lip service to family commendation policies : Doug. Dokolosky, a former IBM executive who specializes in coaching women, argues that “to reach the top require sacrifice and long hours. If that is your ambition, forget things like balancing work and family”. Do you think most US firms just pay li..
Identify legal and ethical issues involved : Up to this point, Ed has been paying all of his employees a salary. Discuss the benefits and drawbacks of this procedure. In addition, identify legal and ethical issues involved. Consider also the impact on the business to have employees who potentia..
The apostles were confident that the holy spirit : The apostles were confident that the Holy Spirit had been given to the Gentile believers. Why was this crucial for their decision in Acts 15? According to Dye, why is this same confidence crucial for missionaries today?
Write a complete java method called checkword : 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..
What is the electric flux density just above its surface : If the surface charge density on the surface of a conductor is 10 mC/ m2, what is the electric flux density just above its surface?
Risk identified include the ranking and risk response plan : Due to globalization within your industry, you have been appointed as the project manager for an R & D project. Your task is to create a new technologically advanced solar cell. Identify four potential risks for this project. Make assumptions where n..
Heineken n. v. reports the following information : Heineken N. V. reports the following information for its Loans and Borrowings as of December 31, 2010, including proceeds and repayments for the year ended December 31, 2010 (euros in millions).
Many now-defunct splinter-sects of judaism : Why does M.R. Thomas say that the Acts 15 council was the “greatest crisis” of the Church? How would it have been possible for the movement of Christ-followers to become one of many now-defunct “splinter-sects” of Judaism?

Reviews

Write a Review

Financial Accounting Questions & Answers

  Financial statement analysis and preparation

Financial Statement Analysis and Preparation

  Shareholder of a company

Describe the ways that a person can become a shareholder of a company. Why Wal-Mart would split its stock?

  Financial and accounting principles

An understanding of financial and accounting principles can be a valuable tool for managers. While not all managers will find themselves calculating financial ratios or preparing annual financial data.

  Prepare a statement of cash flow using the direct method

Prepare a Statement of Cash Flow using the Direct Method and Prepare the Operations section of the Statement of Cash Flow using the Indirect Method.

  Financial accounting assignment

This assignment has one case study and two question apart from case study. Questions related to document Liquidation question and Company financial statements question - Torquay Limited

  Prepare general journal entries for goela

Prepare general journal entries for Goela Ltd

  Principles of financial accounting

Prepare the journal entry to record the acquisition of the assets.

  Prepare general journal entries to record the transactions

Prepare general journal entries to record the transactions, assuming use of the periodic inventory system

  Global reporting initiative

Compare the view espoused by the economist Milton Friedman about the social responsibilities of business with the views express by Stigler.

  Explain the iasb conceptual frameworks

Explain the IASB Conceptual Framework's perspective of users and their decisions.

  Determine the company''s financial statements

T he focus of the report is to determine the extent to which you are comfortable relying on the financial statements as presented by management .

  Computation of free cash flow

Computation of Free Cash Flow

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd