Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The hex 2 Dec ( String hexString ) method, which comverts a hex string into a decimal number. Re - implement the hex 2 Dec
The hexDecString hexString method, which comverts a hex string into a decimal number.
Reimplement the hexDec method to throw a NumberformatException if the string is not a
hex string. Catch the exception inside the while loop of main and stay in the program until the
user types
package exceptions:
inport java.utitcanner;
public class ToDecinal.
i
public static int bexfodeciaalString hex
i
int decinalvalue ;
for int ; hex. length; i
char hexchar hex.charat:
decinalValue decinalValue hexCharToDecinolhexChar:
l
return decinalvalue;
public static int hexharTobecinallchar ch
f
return :
else ch is or
return ;
public static void adintringlt args
i
Scanner input new Scanner
Systen.in
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started