Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE FINSIH THE SMALL BOLDED METHOD import java.util.HashMap; public class NumberBase { private static HashMap constants_to_int = new HashMap () {{ put(Character.valueOf('0'), 0); put(Character.valueOf('1'), 1);

PLEASE FINSIH THE SMALL BOLDED METHOD import java.util.HashMap; public class NumberBase { private static HashMap constants_to_int = new HashMap() {{ put(Character.valueOf('0'), 0); put(Character.valueOf('1'), 1); put(Character.valueOf('2'), 2); put(Character.valueOf('3'), 3); put(Character.valueOf('4'), 4); put(Character.valueOf('5'), 5); put(Character.valueOf('6'), 6); put(Character.valueOf('7'), 7); put(Character.valueOf('8'), 8); put(Character.valueOf('9'), 9); put(Character.valueOf('a'), 10); put(Character.valueOf('b'), 11); put(Character.valueOf('c'), 12); put(Character.valueOf('d'), 13); put(Character.valueOf('e'), 14); put(Character.valueOf('f'), 15); put(Character.valueOf('g'), 16); put(Character.valueOf('h'), 17); put(Character.valueOf('i'), 18); put(Character.valueOf('j'), 19); put(Character.valueOf('k'), 20); put(Character.valueOf('l'), 21); put(Character.valueOf('m'), 22); put(Character.valueOf('n'), 23); put(Character.valueOf('o'), 24); put(Character.valueOf('p'), 25); put(Character.valueOf('q'), 26); put(Character.valueOf('r'), 27); put(Character.valueOf('s'), 28); put(Character.valueOf('t'), 29); put(Character.valueOf('u'), 30); put(Character.valueOf('v'), 31); put(Character.valueOf('w'), 32); put(Character.valueOf('x'), 33); put(Character.valueOf('y'), 34); put(Character.valueOf('z'), 35); }}; private static HashMap constants_from_int = new HashMap() {{ put(0 , Character.valueOf('0')); put(1 , Character.valueOf('1')); put(2 , Character.valueOf('2')); put(3 , Character.valueOf('3')); put(4 , Character.valueOf('4')); put(5 , Character.valueOf('5')); put(6 , Character.valueOf('6')); put(7 , Character.valueOf('7')); put(8 , Character.valueOf('8')); put(9 , Character.valueOf('9')); put(10, Character.valueOf('a')); put(11, Character.valueOf('b')); put(12, Character.valueOf('c')); put(13, Character.valueOf('d')); put(14, Character.valueOf('e')); put(15, Character.valueOf('f')); put(16, Character.valueOf('g')); put(17, Character.valueOf('h')); put(18, Character.valueOf('i')); put(19, Character.valueOf('j')); put(20, Character.valueOf('k')); put(21, Character.valueOf('l')); put(22, Character.valueOf('m')); put(23, Character.valueOf('n')); put(24, Character.valueOf('o')); put(25, Character.valueOf('p')); put(26, Character.valueOf('q')); put(27, Character.valueOf('r')); put(28, Character.valueOf('s')); put(29, Character.valueOf('t')); put(30, Character.valueOf('u')); put(31, Character.valueOf('v')); put(32, Character.valueOf('w')); put(33, Character.valueOf('x')); put(34, Character.valueOf('y')); put(35, Character.valueOf('z')); }}; // Convert from base N to base10 private static int toBase10(String input, int base_in) { int sum = 0; int i = 0; int n = input.length(); // TODO: Fill out this method. return sum; }  public static String convert(String input, int base_in, int base_out) { // Convert to Base 10 first int base_10 = toBase10(input,base_in); // Convert to the Output Base String result = toBaseN(base_10,base_out); return result; } public static void main(String args[]) { // Some examples of converting. System.out.println(convert("100",10,10)); System.out.println(convert("1",2,10)); System.out.println(convert("10",2,10)); System.out.println(convert("f",16,10)); System.out.println(convert("m",32,10)); System.out.println(convert("1",10,2)); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions

Question

Why does agriculture subsidies cause overproduction?

Answered: 1 week ago

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago

Question

2. Define identity.

Answered: 1 week ago

Question

4. Describe phases of majority identity development.

Answered: 1 week ago