Question: Instructions: Write a program that reads the contents of the adjacent file: BinaryNumbers.txt and converts each number, one per line, to their decimal equivalent. In

Instructions: Write a program that reads the contents of the adjacent file: BinaryNumbers.txt and converts each number, one per line, to their decimal equivalent. In addition:
a. Write the bin2Dec(String binaryString) method to convert a binary string into a decimal number.
b. Implement the bin2Dec method to throw a NumberFormatException if the string is not a binary number.
c. If the method throws an exception, display "Not a binary number", followed by the input string, as shown below.
Sample Program Output:
Please note:
1. You may only use material covered in this course so far
2. Programs with syntax errors will not be accepted
Grading Criteria:
1. Program / Module Description: \(10\%\)
2. Following Course Coding Conventions: \(10\%\)
3. Correct implementation of try-catch blocks, per above instructions: \(40\%\)
4. Output formatting matches examples: \(20\%\)
5. Accuracy of results: \(20\%\)
Instructions: Write a program that reads the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!