Question: Program Specification: Implement methods parseBinary(String binaryString) , which converts a binary string into a decimal number and parseHex(String hexString) which converts a hexadecimal string into

Program Specification:

Implement methods parseBinary(String binaryString), which converts a binary string into a decimal number and parseHex(String hexString) which converts a hexadecimal string into a decimal number. Implement parseBinary method to throw a BinaryNumberFormatException if the string is not a valid binary string. Implement parseHex method to throw a HexNumberFormatException if the string is not a valid hexadecimal string. Create custom Exception classes BinaryNumberFormatException andHexNumberFormatException extending NumberFormatException that is predefined in Java. The custom exception classes must keep track of the first illegal character that occurred in the string. Create a program called Assignment2.java with UI to get user inputs and display output. Use figure 1 as guideline (doesnt have to be exactly like the figure). Textfields are used to receive user input and display the decimal string or an error message in case an exception occurs as shown in figure 2 and 3. This program should use the parseBinary and parseHex methods to perform the conversion and display the results. In case exception occurs, display an error message that includes the illegal character as shown in figure 3.

(Hint: For the UI, refer to last semesters notes on GUI. Create a Frame with a panel on it. Add text fields and a buttons on the panel)

Program Specification: Implement methods parseBinary(String binaryString), which converts a binary string into

Figure 1: UI Guideline

a decimal number and parseHex(String hexString) which converts a hexadecimal string into

Figure 2: Screenshot showing valid inputs

a decimal number. Implement parseBinary method to throw a BinaryNumberFormatException if the

Figure 3: Screenshot showing the BinaryNumberFormatException message

SUBMISSION:

The submission package should have the following:

Design (Flowchart, List of modules/classes/methods) include within this documentss

Source code: Assignment2.java, BinaryNumberFormatException.java, HexNumberFormatException.java

Code Review checklists (marked) provide comments on issues found (at least 3 issues must be found and documented)

Javadoc documentation: HTML files (index.html and all supporting files)

4 test cases with inputs and expected outputs (list them at the end of this document)

Binary String Decimal String Convert To Decimal Hexadecimal String Decimal String Convert To Decimal Lab: Exception Handling

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 Databases Questions!