Comment

Cabrera

November 25, 2007 at 3:20 PM

pls giv me a code that will convert a hexadecimal to a decimal.You are to implement a Number System Converter program using java or c/c++. Your program must at least satisfy the requirements below: User Input: Input a HEXADECIMAL number. Select between operation: (a) multiplication OR (b) addition. Process You have to implement two different methods in converting the number. Method 1: o Uses the usual technique in computing for the equivalent of the number. o In this method, depending on the position in the string, each digit has an associated value of an integer raised to the power of 16. The total sum of the values for each of the digits generates the decimal equivalent of the input value. o Ex. 3A2(base16) = (3x16^2) + (10x16^1) + (2x16^0) = o In short, the function must require an input parameter, performs the (usual) conversion and outputs the result of the function. Method 2: o The second method prohibits the use of multiplication and exponential function. Thus, you can implement the program that uses repeated addition every time you need to find the product or power of a number. o Ex. 21B (base16) = [(16+16+16+16+16+16+16+16+16+16+16+16+16+16+16+16) +(16+16+16+16+16+16+16+16+16+16+16+16+16+16+16+16)] +[(16)] +[(11)] = 539 o You can create another function that will perform the repeated addition operation that substitutes the multiplication operation. Program Output Display the STEP-BY-STEP SOLUTION in converting a HEX-to-DEC. The program must have a COUNTER that will serve as an indicator of the number of steps needed before the program terminates. And the equivalent DECIMAL NUMBER of the input value.

View All Comments | View Tutorial

View All Comments | View Tutorial

Related Tutorial and Articles

Advertisements
Advertisements

- Go Programming Language
- How to set placeholder in uitextfield programmatically?
- Example code of adding placeholder in UItextFeild
- Fix Scrollbar position in a checkboxList after postback
- solution for mapping hibernate and pojos from net beans through database
- java
- Information Save Alert
- program explination
- create plugins to detect suspicious ajax
- output variable