Question: Hexa 2 Deci vimal is learning musical notes from an ancient script and trying to decode that script. Each symbol is written in 4 digit

Hexa 2 Deci

vimal is learning musical notes from an ancient script and trying to decode that script. Each symbol is written in 4 digit or 5 digit hexadecimal value. Help her by writing a Java code to convert the given musical hexadecimal tone into its corresponding decimal value.

Note: For hexadecimal, number 0 to 9 represents the value zero to nine, and alphabet A to F represents the value ten to fifteen. If any other character found in input, then print " is Invalid". The length of input string must be either 4 or 5. If it was lesser than 4 orgreater than 5, then print " is a digit input".

Sample Input 1:

1D1D1

Sample Output 1:

119249

Sample Input 2:

266F

Sample Input 2:

9839

Sample Input 3:

97M

Sample Input 3:

97M is Invalid

Sample Input 4:

653412

Sample Input 4:

653412 is a 6 digit input

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!