Posted by : Unknown viernes, 24 de octubre de 2014

SDP03 Exercise 06

October 24th, 2014

In this exercise we had to add some code lines in order to make the application to show to the user the number that are written in the datafile.txt file. The purpose is that the results are presented organized by mantissa, characteristic, and sign. 

By reading the instructions, we understood what a mantissa is and what the characteristic expresses. Other thing that we had to consider was that the sign must be managed like a Char type variable because the compiler tends to multiplicative them and the result shown in the screen is incorrect.

The first thing we do was to declare several variables; type char to manage the signs, String to manage the mantissa and characteristic values, byte to declare a counter used in the process, and boolean to define different points that will work like a reference to solve the different situations according to the numbers read from the text file.

Then, we wrote some lines in a while cycle to read the numbers and we keep it on a array that is divided into char values by using the [array name].charAt(counter variable);

After that, we declared a switch structure that worked by analyzing the set of conditions given and following a corresponding path to the sign or exponent found in the data file.

Next, we added some if's above the switch structure that are going to be evaluated according to the elements found in the code lines.

Finally, the lines to show the result in the screen were already written, we only added the values to be shown.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Popular Post

Blogger templates

Con tecnología de Blogger.

- Copyright © Zavala Zavala - Computing and Problem Solving -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -