The goal is for the program to learn words as it reads characters.
[url removed, login to view]: import
[url removed, login to view]: import word1 word1
import* word1? word1@
It recognizes that import is a reserved word (it was present in [url removed, login to view]) and indicates it with the *
It recognizes that word1 is a new word so it marks it with a ? and saves it
It recognizes that is saw word1 before so it marks it with a @
-----------How to do it----------------------
You should have 3 arrays:
switch - type int - size 54 - this contains the index of the first word that starts with that character.
These two are parallel arrays:
symbol - type char - size MAX_SIZE - holds what character is consumed at this spot
next - type int - size MAX_SIZE - holds where to jump to if the character you want isn't at this spot
You also need an int to store the currently used size of the two parallel arrays - I will call it sizeUsed
You are to read the file one character at a time.
example word: aWord3
If this character is 'A'-'Z', 'a'-'z', '_' or '$', it is the beginning of a word (if it is not one of these, ignore it).
You have to take this first character and turn it into the corresponding index of the switch array.
The standard is: 'A '-> 0, 'B' -> 1, ..., 'Z' -> 25, 'a' -> 26, ... , 'y' -> 50, 'z' - > 51, '_' -> 52, '$' -> 53.
So for example if you encounter 'a' first you need to check switch, so on.
The value of the switch array corresponds to the index in symbol where that word is continued. If it is a set number, follow it to the next step. If the index is undefined (I indicate this with -1), you have to set it to the next free index (sizeUsed) and use that for the next part.
Now you move on to the parallel array. You check the next letter, in our case 'W', if it is what is in symbol[switch]. If it is, you simply go to the right (symbol[switch + 1]) and compare with the next character and so on. If symbol[x] contains a blank character (I used ' ' for this), you need to write the current character there and increase max size. If symbol[x] contains a character other than what you are consuming right now, you look at the next[x] (using the same index as what you just used with symbol), and try looking at symbol[next[x]]. If next[x] is undefined (in my case -1 again), I set it to the next free index (sizeUsed) and continue there.
Finally, once you encounter a character not 'A-Z', 'a-z', '_', '$', or '0'-'9' (a word may not start with 0-9 but it CAN have it afterwards), you expect to reach an "end of the line" character. If you are writing the word, you need to place an end of the line character. There are 2 end of the line characters: '*' which you use when inputting/reading the reserved words ([url removed, login to view]) and '@' which you use when inputting/reading the java program ([url removed, login to view]); either one indicates you successfully matched the word when reading.
Last thing is you have to make sure during this whole process the output text gets generated. So when you know you have a word you need to be storing/printing the characters, and you have to print a '?' if you had to write the word and a '@' or '*' if you read the word, depending on what it stored.
23 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön
As description in your requirement. I'm sure to complete this tool for you. inbox me if you have any question about my skill or this project. Thank for your attention HuyPQ.
Hello Sir, I am interpreted in doing this work in minimum time and minimum cost for you. i have more than 6 years of expertise in java development. Eagerly awaiting to hear from you sir. Thanks, meenakshi
Hello I am an expert in java development and can easily carry out this task for you. I have vast experience in java and can handle the job fairly quickly for you. Regards
Seems like an interesting problem to be solved and will get to learn more solving this problem. I understood the problem to very extent. Just need bit more information and we are all set.