Code Monkey home page Code Monkey logo

numeral-system-converter's Introduction

A text-based mathematical helper application built in Java. The program converts any kind of number (both integers and fractionals) from one numeral system to another, according to its base (radix). The later can range from 1 to 36. Among the most popular numeral systems it can convert from and to are:

  • binary (base 2): made of 0s and 1s, each digit represents a bit;
  • octal (base 8): made of eight numbers (0, 1, 2, 3, 4, 5, 6, 7);
  • decimal (base 10): made of ten numbers (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). This is the conventional numeral system used nowadays by most humans that was originally introduced in medieval times by the Arabs;
  • hexadecimal (base 16 or hex): made of 16 symbols - 0 to 9 are used to represent values from zero to nine while "A"โ€“"F" (or alternatively "a"โ€“"f") represent values ten to fifteen.

Apart from integers, the program also allows the user to convert fractional numbers in between two differente base systems. In order to execute it, the user needs to enter three symbols, each in a different line:

  • the number representing the source radix;
  • the symbol representing the source number;
  • the number representing the target radix.

If any one of the inputs entered by the user is not validated by the program (for instance, if one of the numbers representing a radix goes beyond the accepted number range - from 1 to 36 - or if the symbol representing the number can not be converted to the given radix), the user is presented with an error message

Example 1:

Input:

10 0.234 7

Output:

0.14315

Example 2:

Input:

10 10.234 7

Output:

13.14315

Example 3:

Input:

35 af.xy 17

Output:

148.g88a8

Example 4:

Input:

16 aaaaa.0 24

Output:

22df2.00000

Example 5:

Input:

21 4242 6

Output:

451552

Example 6:

Input:

1 1111111 10

Output:

7

numeral-system-converter's People

Contributors

remixtures avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.