Sunday, May 25, 2008

hey well i had a update check and it said you can update java for mac os x. What does java do for my computer?
also how do you un instal a program or a application on my mac os x 10.4?

Write a program that keeps track of a class roster and performs various functions based on it. This roster will hold the names of the students- but no scores. We want to perform some functions- like searching for a student by first name- searching for a student by last name- and listing the entire class list.
Now- modify the program to be in two classes. Organize your code similarly to the class example from Friday- May 16th. All I/O (input / output - printing to the screen- reading from the keyboard) must be performed in the main class (UseClassRoster)- and all storage of the roster as well as computation on the roster must be done in the other class (ClassRoster). Be very careful about choosing return types and input parameters.

well- I heard this million of times...
Linux beats the crap out of Windows.
I m a Java programmer but also some sort of gamer.
I use my computer for programming- movies- music- downloading....cooking :D
So is it really the right step to switch to Linux specially with all the hype about Fedora 9??
I didn t mean particularly "cool".
I mean what should I be getting more if I switch to Linux?

ok- here is my code. it is a basic String encryption. I am wanting to write a separate program that will brute force the encrypted string until is gets it right. like trying every combination of letters. aaa- aab-aac-aad etc.

can anyone help me?

import Java.io.*;


public class NewEncryption
{
public static String encrypt(String origText)
{
if (origText == null)
return "Incorrect Text. Try Again";
String passcode = "";
for(int k =0- k < origText.length(); k++)
{
char x = origText.charAt(k);

if (x >= a && x <= m )
x += 13;
else if (x >= n && x <= z )
x -= 13;
else if (x >= A && x <= M )
x += 13;
else if (x >= N && x <= Z )
x -= 13;
passcode += x;
}
return passcode;
}
public static void main(String [] args)
throws IOException {

String input = "";


if (args.length <= 3) {
int argNumber = 0;
while (argNumber < args.length) {
if ("-e".equals(args[argNumber])) {
argNumber ++;
input = args[argNumber];
argNumber ++;
}
else if ("-h".equals(args[argNumber])) {
System.err.println(usage());
System.exit(0);
}
else {
System.err.println("Error: unexpected argument " + args[argNumber]);
System.err.println(usage());
System.exit(1);
}
}

}
else {
System.err.println("Error: Too many arguments.\n" + usage());
System.exit(1);
}


if (input.length() == 0) {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));

String s;
while ((s = in.readLine()) != null) {
input += s + "\n";
}

}
System.out.println(encode(input));


System.exit(0);


}


private static String usage() {
return "Usage: java -jar rot13.jar [-h] [-e \"text to be encoded\"] [< plaintext] [> ciphertext]\n" +
"where arguments are:\n" +
"-e encode text on the command line\n" +
"-h print this message";
}

}

in java

No comments: