![]() |
$10 to finish this java program for me
All my funds are tied up right now, but I'm good for it. I'll send it in under a week. I'm almost done but I'm so tired that it'll take me hours to do the rest of it.
What I have so far is here. The encryption part is done. I just need the decryption part, which is partly finished. It's tougher than the encryption part. I think you'd have to loop through to find where the characters end. I was starting a loop to find where the spaces are. This is the assignment: Create a program that does the following: 1. Displays a short menu, asking the user to choose whether he/she wishes to encrypt data or decrypt data, or if he/she wishes to exit the program. 2. Prompt the user to enter an integer, which will be used as a private key. 3. If the user wishes to encrypt data, prompt the user to enter a phrase or sentence of text. On a character by character basis, convert that text into ASCII code and add the private key to each ASCII code. Print out the code as your convert it. 4. If the user wishes to decrypt data, prompt the user to enter code. On a code by code basis, subtract the private key and translate the resulting ASCII value into a letter, space, period or digit. Print out the text as you convert it. Your program should redisplay the menu after each translation is finished. It should terminate only when the user selects the exit/quit option from the menu. |
Re: $10 to finish this java program for me
This encryption method is pretty weak.
|
Re: $10 to finish this java program for me
1. this isn't encryption.
2. i normally don't get out of bed for less than $500 but for you, i'll do it for $100. |
Re: $10 to finish this java program for me
I realize it's not encryption. It's just an assignment I have to do. Is anyone trying this?
|
Re: $10 to finish this java program for me
dude no one competent is going to do this for $10.
|
Re: $10 to finish this java program for me
[ QUOTE ]
I just need the decryption part, which is partly finished. It's tougher than the encryption part. I think you'd have to loop through to find where the characters end. I was starting a loop to find where the spaces are. [/ QUOTE ] Spaces are ASCII characters too. This isn't any harder than looping through each character of the "encrypted" string, "decrpyting" it and appending the result to the end of the result string. You need to pay someone to do this for you? Sad. |
Re: $10 to finish this java program for me
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.
|
Re: $10 to finish this java program for me
I don't think it would take anyone competent more than 10 minutes max.
On another note, does anyone know how you would do this problem? Write a Java program that accepts a string from a terminal and converts all the lowercase letters in the string to uppercase, and all the uppercase letters in the string to lowercase. It's not arrays because we have not reached that chapter yet. |
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 ] What the input is going to be is irrelevant - it should be able to be anything. Work out a plan before you start thinking of the actual code. Here's a possible solution: - You have an input string --- Determine the total length of that string (accounting for ALL characters) --- Create a loop that will execute a number of times equal to the length of the string --- In each iteration of the loop ----- Find the character at the position in the string for that # iteration ----- Convert this character ----- Add the converted character to a second string that will be used to display the result |
Re: $10 to finish this java program for me
That won't work because it will convert individual digits into characters, not the entire number.
|
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. |
Re: $10 to finish this java program for me
Dude, just give it up now. Java made me want to kill myself.
|
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? |
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. |
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. |
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. |
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.
|
Re: $10 to finish this java program for me
Shouldn't be downing a bottle of hot sauce or something?
|
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. |
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. |
Re: $10 to finish this java program for me
[ QUOTE ]
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. [/ QUOTE ]Yeah that was the main problem. I was starting to do a loop to find out where there are spaces and try to find a string method that would let me input what character range to use. String tokenizer saved me. |
Re: $10 to finish this java program for me
there are many bugs possible with char overflows and non numerics in the codes you are on your own.
StringTokenizer st = new StringTokenizer(s3, " "); while(st.hasMoreTokens()) { String token = st.nextToken(); int ascii = Integer.parseInt(token); System.out.print(new Character((char) (ascii-key))); } test results 1 - Encrypt Data 2 - Decrypt Data 3 - Exit Program 1 Private Key? 1231458 Enter text for encryption kurush is a dummy 1231565 1231575 1231572 1231575 1231573 1231562 1231490 1231563 1231573 1231490 1231555 1231490 1231558 1231575 1231567 1231567 1231579 1 - Encrypt Data 2 - Decrypt Data 3 - Exit Program 2 Private Key? 1231458 Enter code for decryption 1231565 1231575 1231572 1231575 1231573 1231562 1231490 1231563 1231573 1231490 1231555 1231490 1231558 1231575 1231567 1231567 1231579 kurush is a dummy 1 - Encrypt Data 2 - Decrypt Data 3 - Exit Program |
Re: $10 to finish this java program for me
I think spaces in the encrypted string are fine, because everything else should be integers. So a space in the original string would convert to 32 + whatever key was given. Although as a habit I do like to use something less common than a space. But anyways, I know very little about Java, but as others have mentioned, there must be some function out there (or whatever Java calls them) to split your encrypted strings at the spaces (in Perl, this would be pretty easy, @string=split(/\s/,$encrpytedstring), or something like that). Obviously the way you're doing it now isn't good because you're reading one character at a time, and a single integer may consist of more than one character. Also I'm not sure if what you're reading in is being interpreted as an integer or a character, which might give you problems.
I haven't touched a programming language of any kind in about 4 years, so if anyone disagrees with what I'm saying, you probably know better than I do. |
Re: $10 to finish this java program for me
n/m
I wasn't considering the decrypt portion. Much harder than the encrypt part. I need to work on my reading comprehension. |
Re: $10 to finish this java program for me
Pretty much what I did:
StringTokenizer st = new StringTokenizer(s3); while(st.hasMoreTokens()) { s2 = st.nextToken(); a = Integer.parseInt(s2); a = a-key; y = (char) a; System.out.print(y); } |
Re: $10 to finish this java program for me
Thats what you need to encrypt
Put the first block in the appropraite place. Put the 2nd block inside the class{} but outside the main{} //String theStringToEncrypt; for(int i = 0 ; i < theStringToEncrypt.length() ; i++) { char a = theStringToEncrypt.charAt(i); System.out.println(convertChar(a)); } public int convertChar(char aLetter , int theKey) { int temp = (int) aLetter; return (temp + theKey); } |
Re: $10 to finish this java program for me
[ QUOTE ]
Thats what you need to encrypt Put the first block in the appropraite place. Put the 2nd block inside the class{} but outside the main{} //String theStringToEncrypt; for(int i = 0 ; i < theStringToEncrypt.length() ; i++) { char a = theStringToEncrypt.charAt(i); System.out.println(convertChar(a)); } public int convertChar(char aLetter , int theKey) { int temp = (int) aLetter; return (temp + theKey); } [/ QUOTE ] If you use what I wrote appropraitely the result of encrypting "abcd efgh" (with the key = 0) should be :: 97 98 99 100 (whatever a space is in asci) 101 102 103 104 this is assuming that an 'a' when cast to an int is 97 (which it may not be because I don't have a table in front of me) |
Re: $10 to finish this java program for me
This is why coding is one of the most painful professions to go into. I had to take about 5 coding classes of 3 different languages. All are a pain, and java by far is the most strict on syntax compared to all the other languages.
|
Re: $10 to finish this java program for me
[ QUOTE ]
On another note, does anyone know how you would do this problem? Write a Java program that accepts a string from a terminal and converts all the lowercase letters in the string to uppercase, and all the uppercase letters in the string to lowercase. It's not arrays because we have not reached that chapter yet. [/ QUOTE ] Aren't their methods in the api to do this? I don't know them off the top of my head, but toLowerCase(), toUpperCase()? Even without them, just find a relationship between lower case and upper case ASCII values and do it that way. |
Re: $10 to finish this java program for me
[ QUOTE ]
This is why coding is one of the most painful professions to go into. I had to take about 5 coding classes of 3 different languages. All are a pain, and java by far is the most strict on syntax compared to all the other languages. [/ QUOTE ] No. Someone who struggles with syntax is not going to have success as a programmer. |
Re: $10 to finish this java program for me
[ QUOTE ]
[ QUOTE ] On another note, does anyone know how you would do this problem? Write a Java program that accepts a string from a terminal and converts all the lowercase letters in the string to uppercase, and all the uppercase letters in the string to lowercase. It's not arrays because we have not reached that chapter yet. [/ QUOTE ] Aren't their methods in the api to do this? I don't know them off the top of my head, but toLowerCase(), toUpperCase()? Even without them, just find a relationship between lower case and upper case ASCII values and do it that way. [/ QUOTE ] Most likely the second part is what is required. Just do a check for the value and if less than X, add Y, etc. Get a chart of the values and you should be good. |
Re: $10 to finish this java program for me
Already did it. Converted them to integers then added or subtracted and converted them back.
|
Re: $10 to finish this java program for me
[ QUOTE ]
Already did it. Converted them to integers then added or subtracted and converted them back. [/ QUOTE ] oh ok cool. btw, i know it sucks, but unless this is a completely meaningless major for you, really try to get through the programs yourself. ask 1000 questions, but make sure you can do things as well, or its going to get really hard at the end and you'll be frustrated as [censored]... |
Re: $10 to finish this java program for me
A side note, even though you finished already.
Character.isUpperCase(ch)/Character.isLowerCase(ch) Character.toUpperCase(ch)/Character.toLowerCase(ch) These would have helped. I recommend that if you keep programming, make friends with the Java API. It will make your life a lot easier. |
Re: $10 to finish this java program for me
Wow, this reminds me of taking Java last year, but I wasn't smart enough to try to find someone to pay to do it for me.
|
Re: $10 to finish this java program for me
[ QUOTE ]
Someone who struggles with syntax is not going to have success as a programmer. [/ QUOTE ] Especially after 5 classes |
All times are GMT -4. The time now is 04:52 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.