Ask Financial Accounting Expert

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.

Financial Accounting, Accounting

  • Category:- Financial Accounting
  • Reference No.:- M91575052
  • Price:- $20

Guranteed 24 Hours Delivery, In Price:- $20

Have any Question?


Related Questions in Financial Accounting

Case study - the athletes storerequiredonce you have read

Case Study - The Athletes Store Required: Once you have read through the assignment complete the following tasks in order and produce the following reports Part 1 i. Enter the business information including name, address ...

Scenario assume that a manufacturing company usually pays a

Scenario: Assume that a manufacturing company usually pays a waste company (by the pound to haul away manufacturing waste. Recently, a landfill gas company offered to buy a small portion of the waste for cash, saving the ...

Lease classification considering firm guidance issues

Lease Classification, Considering Firm Guidance (Issues Memo) Facts: Tech Startup Inc. ("Lessee") is entering into a contract with Developer Inc. ("Landlord") to rent Landlord's newly constructed office building located ...

A review of the ledger of oriole company at december 31

A review of the ledger of Oriole Company at December 31, 2017, produces these data pertaining to the preparation of annual adjusting entries. 1. Prepaid Insurance $19,404. The company has separate insurance policies on i ...

Chelsea is expected to pay an annual dividend of 126 a

Chelsea is expected to pay an annual dividend of $1.26 a share next year. The market price of the stock is $24.09 and the growth 2.6 percent. What is the cost of equity?

Sweet treats common stock is currently priced at 3672 a

Sweet treats common stock is currently priced at $36.72 a share. The company just paid $2.18 per share as its annual dividend. The dividends have been increasing by 2,2 percent annually and are expected to continue doing ...

Highway express has paid annual dividends of 132 133 138

Highway Express has paid annual dividends of $1.32, $1.33, $1.38, $1.40, and $1.42 over the past five years, respectively. What is the average divided growth rate?

An investment offers 6800 per year with the first payment

An investment offers $6,800 per year, with the first payment occurring one year from now. The required return is 7 percent. a. What would the value be today if the payments occurred for 20 years?  b. What would the value ...

Oil services corp reports the following eps data in its

Oil Services Corp. reports the following EPS data in its 2017 annual report (in million except per share data). Net income $1,827 Earnings per share: Basic $1.56 Diluted $1.54 Weighted average shares outstanding: Basic 1 ...

At the start of 2013 shasta corporation has 15000

At the start of 2013, Shasta Corporation has 15,000 outstanding shares of preferred stock, each with a $60 par value and a cumulative 7% annual dividend. The company also has 28,000 shares of common stock outstanding wit ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As