Question: Java for beginners Need comments (it important ) and output Write a program that user enters 4 position hexadecimal number and you output the decimal
Write a program that user enters 4 position hexadecimal number and you output the decimal value along with hexadecimal value. Thus 4A7C would output Hexadecimal-4A70 equals decimal 19068". You can NOT use any commands to convert text to numbers. Pseudocode: input 4 digit hexadecimal number as string get each character at each position and calculate decimal number 4 A 7 C 4 16310 162 7*161 12 160 4 charAt(O) 10- charAt(1) 7 charAt(2) 12-charAt(3) HINT: Math.pow(16,indexK) is the same as 16indexk see example above. output input string as well as decimal value EXTRA CREDIT-MAKE PROGRAM READ IN HEXADECIMAL NUMBER ANY LENGTH
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
