Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed

Figure 1: UI Guideline

image text in transcribed

Figure 2: Screenshot showing valid inputs

image text in transcribed

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

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions