The next step is to expand our hexaicosadecimal converter to take
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

The next step is to expand our hexaicosadecimal converter to take

Part IV: Convert from a floating point hexaicosadecimal number to a double

The next step is to expand our hexaicosadecimal converter to take not just natural numbers, but floating point (a/k/a rational) numbers. The good news is that you're already halfway done, with your work from the previous section! 

What you need to do is wrap your code from the previous section in an if-else block. IF (the input string does not contain a decimal point), do exactly what you did before. IF (the input string DOES contain a decimal point), do what you did before, except where your code had "the length of the whole string”, you'll instead need "the length of the part of the string that comes before the decimal point." That will get you the whole number part of the number. Then you'll need a second loop that looks just at the part of the string that is to the right of the decimal point, and adds those values into the accumulator. (Hint: Negative exponents correspond to dividing instead of multiplying. That is, 10-1 = 0.1 and 26-1 = 0.03846, 10-2 = 0.01 and 26-1 = 0.001479, and so on.) 

Hint
ComputerCoding: Coding is also called as the computer programming. It is how we communicate with computers. Code tells a computer what actions to take, and writing code is like creating a set of instructions. By learning to write code, you can tell computers what to do or how to behave in a much faster way....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.