Programming Homework Help

Programming Homework Help. Bijective task

Background

bijective base b numerationundefinedbundefinedbundefinedbundefinedbundefinedNo symbol has a value of zero, but the empty string represents zero.

Given a base b greater than 0, a string ak … a0 corresponds to the non-negative number:

bk.ak + … + b0.a0

bk.ak + … + b1.a1 + b0.a0

b.(b(k-1).ak + … + a1) + a0

b.(b.(b(k-2).ak + … ) + a1) + a0

The correspondence is bijective (one-to-one and onto the natural numbers). Popular bijective numerations include unary, bijective base 2 (used in bzip2’s run-length encoding) and bijective base 26 (used to number columns in spreadsheets).

Example for the set of symbols A-Z is as follows:

A 1 (0*26 + 1)

Z 26 (0*26 + 26)

AA 27 (1*26 + 1)

AZ 52 (1*26 + 26)

BA 53 (2*26 + 1)

BZ 78 (2*26 + 26)

CA 79 (3*26 + 1)

ZZ 702 (26*26 + 26)

AAA 703 (1*26*26 + 1*26 + 1)

The Task

undefinedorderedundefined

123456789#$%ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Read from the standard input stream and write to the standard output stream.

Each line contains three strings: two bases a and b, where 1 <= a, b <= 64, encoded in bijective base 64, and in between a string n encoded in bijective base a.

For each of the line your task is to output n as a bijective base b string.

None of the strings will be the empty string.

——————————————————————-

You must read three strings as input.
First string is your input base,
Depending on the base you chose, enter second string (must be in the base of first string).
Third string is the destination base, this is the base you want to convert your second string to.

Java Bijection <base1> <str for base1> <base2>

Now example:
Java Bijection A $ 1

Notice the pattern we ask your to follow for range of base 64:

123456789#$%ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

A is base 13. (count in the above pattern, A has count 13)
Now second string can be input anywhere from 123456789#$%
You can have a pattern of range 1 to 13 from these bases. We have chosen example ‘$’ (this has count 11)

Third string ‘1’.
This is the destination base. So you want to convert ‘$’ which was in base A to a string of base 1.

Now since base 1, can consist of only one char that is ‘1’, the only option you have is to represent ‘$’ in 1s.
So the output you get after converting is 11111111111 (11 1’s )

Approach to your code:

Read everything with scanner, so you can use this obj later
convert string1, str 3 base strs into int
convert base 1 str into decimal
convert the decimal to base 2 and output as a string

It would help if you used methods to avoid complexity errors.

Sample Input

5 34152 5
A $ 1
A $ 2

Sample Output

34152
11111111111
21

Programming Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"