Again, we're building on our solution from Part VI, in which we solved
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Again, we're building on our solution from Part VI, in which we solved

Part VII: Convert from a double WITH OR WITHOUT A FRACTIONAL PART to a hexaicosadecimal string

Again, we're building on our solution from Part VI, in which we solved for a double that did not have a fractional part. We're about to relax that restriction, so now our input doubles can have a fractional part as well as a whole number part. 

First, we have to get the fractional part. In Part VI, we got the whole number part by converting the double to an integer type. To get the fractional part, all we have to do is subtract the integer from the double. 

If the fractional part is zero, the solution is the same as in Part VI. If the fractional part is NON zero, things get a bit trickier. There are multiple ways to solve this problem, but the easiest one is to essentially use the same method we did in Part V. However, before we can use that same algorithm, we have to convert the fractional part to a corresponding integer type value. (For example, if the fractional part was 0.25, the corresponding integer type value would be 25; if the fractional part was 0.12345, the corresponding integer type value would be 12345. In short, you need to move the decimal point to the right end of the number.) If we could do that, we'd be set; we'd just be able to run the algorithm from Part V once on the whole number part, put a "" in the middle, and then run it again on the corresponding integer for the fractional part. 

I'm leaving the rest to you. There are a number of ways to generate the corresponding integer values for a fractional part. You have all the tools you need already; it can be done in a handful of lines with just a loop and basic Java mathematical operations. (But a more elegant solution might be found if you look into other Java classes, such as the BigDecimal class...) 

Hint
ComputerAlgorithm is a set of instructions to solve a problem or even accomplishing a task. Every computerized device mainly uses algorithms, because of which the time is cut which are required to do things manually. Also, algorithmic trading is called as the automated trading or black-box trading, and uses a computer program to buy or sell the securities at a pace which is not possible for humans...

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.