Exercise 2 (30/40): Write a program that reads in a set of coin descriptions from a file. The input file has the format coinNamel value is coin Valuel coinName2 value is coinValue2 Add a method to your program that receives file content and writes back to another file statistics about the coins. Sample input file Riyal value is 25 Baisa value is 6.0 BHR value is baisa value is 5.30 Riyal value is 23.5 Sample output file Riyal = 24.25 Baisa =5.65 BHR = 9.5 In the solution 9.5 1. use the coin class provided on Moodle. 3. Handle any two exceptions to make sure the input file holds the correct transactions format (FileNotFoundException is not one of them) Information: Illegalargumentexception: The IllegalArgumentException is an unchecked exception in Java that is thrown to indicate an illegal or unsuitable argument passed to a method. It is one of the most common exceptions that occur in Java. Input MismatchException: The InputMismatchException generally occurs when working with Java programs that prompt users for input using the Scanner class. The exception can occur when the input is invalid for the expected type. The input either does not match the pattern for the expected type, or is out of range

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Exercise 2 (30/40):
Write a program that reads in a set of coin descriptions from a file. The input file has the format
coinNamel value is coin Valuel
coinName2 value is coinValue2
Add a method to your program that receives file content and writes back to another file statistics about
the coins.
Sample input file
Riyal value is 25
Baisa value is 6.0
BHR value is
baisa value is 5.30
Riyal value is 23.5
Sample output file
Riyal = 24.25
Baisa =5.65
BHR = 9.5
In the solution
1. use the coin class provided on Moodle.
3.
Handle any two exceptions to make sure the input file holds the correct transactions format
(FileNotFoundException is not one of them)
Information:
9.5
●
Illegalargumentexception: The IllegalArgumentException is an unchecked exception in Java
that is thrown to indicate an illegal or unsuitable argument passed to a method. It is one of the
most common exceptions that occur in Java.
InputMismatchException: The InputMismatchException generally occurs when working with
Java programs that
prompt users for input using the Scanner class. The exception can occur
when the input is invalid for the expected type. The input either does not match the pattern for
the expected type, or is out of range
Transcribed Image Text:Exercise 2 (30/40): Write a program that reads in a set of coin descriptions from a file. The input file has the format coinNamel value is coin Valuel coinName2 value is coinValue2 Add a method to your program that receives file content and writes back to another file statistics about the coins. Sample input file Riyal value is 25 Baisa value is 6.0 BHR value is baisa value is 5.30 Riyal value is 23.5 Sample output file Riyal = 24.25 Baisa =5.65 BHR = 9.5 In the solution 1. use the coin class provided on Moodle. 3. Handle any two exceptions to make sure the input file holds the correct transactions format (FileNotFoundException is not one of them) Information: 9.5 ● Illegalargumentexception: The IllegalArgumentException is an unchecked exception in Java that is thrown to indicate an illegal or unsuitable argument passed to a method. It is one of the most common exceptions that occur in Java. InputMismatchException: The InputMismatchException generally occurs when working with Java programs that prompt users for input using the Scanner class. The exception can occur when the input is invalid for the expected type. The input either does not match the pattern for the expected type, or is out of range
Expert Solution
steps

Step by step

Solved in 2 steps with 7 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education