Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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=4A7C

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=4A7C equals decimal 19068. You can NOT use any Java commands that 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 * 163 + 10*162 + 7*161 + 12* 160

4=charAt(0) 10= charAt(1) 7= charAt(2) 12=charAt(3)

HINT: Math.pow(16,indexK) is the same as 16indexK

output input string as well as decimal value -- see example above.

EXTRA CREDIT MAKE PROGRAM READ IN HEXADECIMAL NUMBER ANY LENGTH

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

Students also viewed these Databases questions

Question

What should be the purpose of performance management and appraisal?

Answered: 1 week ago

Question

internationalization of business?

Answered: 1 week ago