Two Plus Two Older Archives

Two Plus Two Older Archives (http://archives2.twoplustwo.com/index.php)
-   Other Other Topics (http://archives2.twoplustwo.com/forumdisplay.php?f=32)
-   -   $10 to finish this java program for me (http://archives2.twoplustwo.com/showthread.php?t=369604)

crunchy1 11-01-2005 01:03 PM

Re: $10 to finish this java program for me
 
[ QUOTE ]
That won't work because it will convert individual digits into characters, not the entire number.

[/ QUOTE ]
What you'll need to do is delimit the ASCII numbers that result from the encryption process. This way you'll have a method of reconstructing the string.

Yeti 11-01-2005 01:07 PM

Re: $10 to finish this java program for me
 
Dude, just give it up now. Java made me want to kill myself.

asofel 11-01-2005 01:10 PM

Re: $10 to finish this java program for me
 
[ QUOTE ]
That won't work because it will convert individual digits into characters, not the entire number.

[/ QUOTE ]

you should be able to cycle through and separate the numbers given where the spaces are, no?

krimson 11-01-2005 01:11 PM

Re: $10 to finish this java program for me
 
You don't need to do anything crazy here. There is something called the "String Tokenizer" (google it) that will help with reading the data. You can set it to use " " as a delimitter and it will parse your string for you.

You can probably find some University/College tutorials that demonstrate this farily easily.

icepick 11-01-2005 01:13 PM

Re: $10 to finish this java program for me
 
[ QUOTE ]
It is harder because it's not just one character. The input is going to be something like 82 123 43 95 and it has to recognize the individual numbers.

[/ QUOTE ]

This statement clearly shows you don't understand the assignment.

Start a loop.
Take the Nth character of your input string.
Convert that char to an ASCII number.
Add the key.
Convert back to a char.
Repeat untill done.

This is one line of perl.

crunchy1 11-01-2005 01:14 PM

Re: $10 to finish this java program for me
 
[ QUOTE ]
You don't need to do anything crazy here. There is something called the "String Tokenizer" (google it) that will help with reading the data.

[/ QUOTE ]
This is a good point that there is probably some class/method combination out there that will do what you need with minimal extra programming.

What you're missing (and what I didn't account for initially either) is that spaces are not an acceptable delimiter - because a space is a valid character in the input string. What you need to consider is that each character in the string is an individual character. Where we need to create and use a delimiter is in the encrypted string - so that we can recreate each individual character from the input string correctly.

kurosh 11-01-2005 01:16 PM

Re: $10 to finish this java program for me
 
Yes, daft told me about the string tokenizer which helped immensely. [img]/images/graemlins/heart.gif[/img] daft. I'm done. No need for anything else. Thanks.

Jeffage 11-01-2005 01:17 PM

Re: $10 to finish this java program for me
 
Shouldn't be downing a bottle of hot sauce or something?

krimson 11-01-2005 01:18 PM

Re: $10 to finish this java program for me
 
I'm pretty Kurosh is trying to say that the input is of the format:

121 134 145 124 154 ...

and he's not sure how to read in the numbers.

krimson 11-01-2005 01:19 PM

Re: $10 to finish this java program for me
 
[ QUOTE ]
Shouldn't be downing a bottle of hot sauce or something?

[/ QUOTE ]
That's Crimson.


All times are GMT -4. The time now is 10:27 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.