MapleStory guides, forums, screens, videos, auctions and new friends await! Signup or login
Feb 17 11
Broa Demon Slayer 3
Humixull
So my java prof just assigned some extra credit today. Being extra credit, its stuff she didn't cover yet in class so I'm not too sure what or how to even go about this.

What we were told to do is "write a java application to edit a textfile ("Orig.txt" by replacing all "I" words with "George"."
There is no actual text file or anything, its just all hypothetical stuff to get a basic idea and understanding.
We were discussing stuff like File IO but didn't get too deep into it. I'm not exactly sure how to even go about this, and I cant really find anything on Google because I'm not too sure what I'm looking for.

Any java experts care to help out with this? Either in the form of telling me what kind of things I should be doing or just what topic specifically I could turn to to find answers?
Share this page Twitter Facebook
New thread Replies
Feb 17 11
Make a loop to search through the entire text file character by character.
Inside that loop you could do an if statement that checks if the letter is an I, and then dissects that string in a substring where it replaces the I part with George.

You phrased the replacing all "I" words with "George"." part kinda weird, so I'm not 100% sure what you need to do.

Replace the word every time it says I? Or if it says a word like..international, internal, imperfect, etc.
Feb 17 11*
Scania Aran 4
ComboRage
That's pretty basic I/O stuff.
There isn't anything particularly advanced needed to do that. Just learn introductory level I/O and you should have your work cut out for you.
Sorry if this is really unhelpful, but there isn't much to say.

EDIT: above, I don't think actually finding and replacing the text is the hardest part of this. Being able to open and save the file seems to be the meat of the assignment.
Feb 17 11
Broa Demon Slayer 3
Humixull
Sorry, I meant replace the word "I" with "George"
Like if the text said "I went to the market." The program would change it to "George went to the market."
Feb 17 11
DemethosGMS Pirate
westerngirl5
I wish I knew Java.. or even studied it.
Feb 17 11
Broa Brawler
TiceNitties
FallenVentus: That's pretty basic I/O stuff.
There isn't anything particularly advanced needed to do that. Just learn introductory level I/O and you should have your work cut out for you.
Sorry if this is really unhelpful, but there isn't much to say.

EDIT: above, I don't think actually finding and replacing the text is the hardest part of this. Being able to open and save the file seems to be the meat of the assignment.

Yeah opening and saving the file might be annoying. However, from working in C++ i learned that there is usually a set amount of code made exactly for this type of thing. All you would do is copy the code and insert the text file name and go from there. I dont know if java has something like that also but im thinking it should.
Feb 17 11
Scania Wind Archer 2
MrWoosh
I forgot how to program but can't you index the incoming string and have it look for a .EqualsIgnoreCase("i"
:o Then assign that a temporary variable
Then declare the something...something...blah with George?

Wow XD I suck at programming.
MapleStory Screen: Finally level 70 ! MapleStory Video: Evan Gameplay
Feb 17 11
Sorry I never learned I/O. School ended right before we got to start that unit xP

Register / login
You must be a member to reply or post. signup or login