Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a method called getNameArray that takes an integer parameter (numNames), returns an array of Strings, and is declared to throw an Exception. If the

image text in transcribed

Write a method called getNameArray that takes an integer parameter (numNames), returns an array of Strings, and is declared to throw an Exception. If the parameter passed is a negative value throw an Exception. otherwise, loop numNames times prompting the user to enter anothe name each pass through the loop. Return this array of names. Write a method called writeNames that takes two parameters an array of Strings (nameArray) and a String (fileName), and returns nothing. Write the array of Strings (names) to a text file named using the fileName parameter. Make sure to catch any Exception that might be thrown. Write a method called readNames that takes a String parameter (fileName) and returns an ArrayList of Strings (nameArrayList). The method reads the text file (filename) and populates the ArrayList with an element for each line in the file. The method returns the populated ArrayList. Make sure to catch any Exception that might be thrown. Write a method called printNames that takes an ArrayList of Strings and prints the contents of the ArrayList to the command line, each on a separate line

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago