Question: Write a program that reads in a set of coin descriptions from a file. The input file has the format: coinNamel coinValuel coinName2 coinValue2 Add

Write a program that reads in a set of coin descriptions from a file. The input file has the format:

coinNamel coinValuel coinName2 coinValue2 Add a method void read (Scanner in) throws

coinNamel coinValuel coinName2 coinValue2 Add a method void read (Scanner in) throws FileNot FoundException to the Coin class of Section 8.2. Throw an exception if the current line is not properly formatted. Then implement a method static ArrayList readFile (String filename) throws FileNotFound Exception In the main method, call readFile. If an exception is thrown, give the user a chance to select another file. If you read all coins successfully, print the total value.

Step by Step Solution

3.56 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To address this programming task well need to write a few pieces of the program that work together 1 A Coin class that should have a method to read a coins name and value from a file 2 A readFile meth... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!