Java Problem

sachii

Member
Sep 17, 2008
8,708
268
0
Ĭǹ Ẏṑũř Ȟĕâřŧ
Ane pls if can you help to make design of the program in Pseudocode and in Java for this question.


In Mathematics, different number systems are in use. The most commonly used number
system is the decimal number system, which has a base of 10. Other number systems in
use are the binary number system (base 2), octal number system (base 8) and the
hexadecimal number system (base 16). They are all positional number systems, where
the decimal value of the number can be obtained by summing the multiplication of each
digit by its corresponding place value. For example, in binary system the decimal
equivalent of the number 1010 can be obtained by the sum:
1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 = 1 x 8 + 0 x 4 + 1 x 2 + 0 x 1 = 12


Your task:

Design a program that would read a number and the base of the number system and print
the
equivalent decimal value.

Assume that the base of the number system is always 10 or less. That is, all the digits of
the number system are a subset of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Examples of
such number systems are those with base 2 (binary), base 8 (octal), base 4, base 5 etc.