Create, compile and test Java function to translate String letter by letter
$10-30 AUD
Teljesítve
Kiadva ekkor: körülbelül 4 évvel ezelőtt
$10-30 AUD
Teljesítéskor fizetve
I need you to create a function in Java translate_string(),
which is doing "translation" of the string letter by letter.
Function takes String as arg, and returns array of String[]:
public static String[] translate_string(String string)
Given existing function translate_letter(),
which takes String as arg and returns array of String[]
public static String[] translate_letter(String letter)
and it translating each letter, you need to sequentially translate
the whole string letter by letter into combination of output strings.
Complexity is, that one character could be translated to multiple
sets of characters, it is not one-to-one relationship between
input string and output string, it is - one-to-many relationship,
where one letter as input could produce multiple combinations
(i.e. arrays) as output.
N.B.: Term translation has nothing to do with actual translation from
one language to another, it is just substitution of one character
to set of other characters.
Below is exact code id simplified version of function
translate_letter() (no modification is required):
//------------------------------------------------------------
// translate letters - return array of diff combinations
public static String[] translate_letter(String s) {
ArrayList<String> o = new ArrayList<>(1);
if ( [login to view URL]("a") ) { // if a
[login to view URL]("a1");
} else {
if ( [login to view URL]("b") ) { // if b
[login to view URL]("b1"); [login to view URL]("b2");
} else {
if ( [login to view URL]("c") ) { // if c
[login to view URL]("c1"); [login to view URL]("c2"); [login to view URL]("c3");
} else {
if ( [login to view URL]("d") ) { // if d
[login to view URL]("d1"); [login to view URL]("d2"); [login to view URL]("d3"); [login to view URL]("d4");
} else {
[login to view URL](s); // s = def add (if nothing above matches)
} // end if d
} // end if c
} // end if b
} // end if a
//Convert ArrayList o to string array[]
String[] array = [login to view URL](new String[[login to view URL]()]);
return array;
} // end translate_letter()
//------------------------------------------------------------
So, how to translate?
Let's have a look at simple version of translate - when
translate_letter() return just string.
So, letter "a" will be translated to "a1", letter "b"
will be translated to "b1", "c" - to "c1".
Input string "a" will be translated as "a1", simple.
Input string "ab" will be translated as "a1b1", simple.
Input string "abc" will be translated as "a1b1c1", simple.
I don't need to create this simple version - it is nothing to do here.
What I need you to write - is complicated version of translate_string(),
when function translate_letter() returns multiple combinations,
i.e. - array of output combinations.
For example (according to the code of translate_letter() above,
letter "a" will be translated to "a1", simple.
But letter "b" will be translated by translate_letter() to 2 combinations:
"b1" and "b2",
and output is String[] array = {"b1", "b2" }
So, string "a" will be translated by translate_string() as array of
just 1 element R[] = { "a1" }
String "ab" will be translated as array of 2 elements
R[] = { "a1b1", "a1b2" }
String "abc" will be translated as:
R[] = { "a1b1c1", "a1b1c2", "a1b1c3", "a1b2c1", "a1b2c2", "a1b2c3" }
String "db" will be translated as:
R[] = { "d1b1", "d2b1", "d3b1", "d4b1" }
Note, that actual sequence of individual
You can use any data structure, supported by Java 11 and below -
Array, 2-dimensional array, ArrayList, Vector, Hash, Map, Tree, Trie, etc,
as soon as it is doing the correct translation.
Preferable - use ArrayList as data structure, but it could be any,
but code needs to be documented to explain what all major steps are doing.
HI..I am proficient in core Java OO programming and can clearly understood the algorithm behind the implementation of translate_string(String s) using given translator_letter() as per posted explanations and can help you write the function and its sample usage in a program.
Hello,
warm greetings!
I am a Java developer working on Java technology since 7+ years having hands on windows and web development experience. I would like to help in your application development.
It would be better if you can share more details about it if you are interested. Please message me to discuss more about the requirements.
looking for your positive response.
Thanks
Namit
Hello, I am an independent, experienced java expert. I can help with this task with a quick turn-around. Looking to hearing from you.
Kind regards
Rina B.
I checked your project carefully.
I have a great interest in your project. I have lots of experience in your project.
I'm sure of completing your project in the shortest time with a high quality.
If you hire me, then your project will be completed more successfully
Greetings Sir, I am Muhammad Faisal and i am a professional Java Developer having almost 5 years of experience and we provide you quality work within your budget and time duration so, lets get started ? Thanks
Do you need the resulting strings in any order? Is there any worst-case running time constraint? I can do it straight away. It will take me just a few hours. If you do have some examples (to use for unit tests), that would be great.
Hello Sir/Madam
I'm Sun Certified Java Programmer. I have development experience in Java
Technologies, OOP, Data Structures, Database Driven applications, APIs, Files and
Data Transformation, ETL and various frameworks. I can help implement awesome Java
desktop (Console, Swing, JavaFX), Web (JEE, Spring) and Android (Java, Kotlin)
application. Contact me with details to get started. I assure you an excellent
solution of your project within the time frame and exactly according to the
requirements.
Thanks
@CodingHelpLine
Hi
In fact, I think I am quite suitable for the compilation of this demo. I can write reasonable functions using Java, and I can do a very good job in code specification and comments. In terms of data structure design, I think I can also efficiently implement this function.
I have sufficient experience and am an expert in writing Java codes that solve problems. I am versed and versatile in using ArrayLists to solve logical problems like this. Give me a chance to prove myself.