Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does.
Printable View
Can someone make a program that creates a simple 4 digit password for a text file, and notate what every line of code does.
Hello pwngrammer and welcome to the java programming forums. I think this belongs in the java program collaboration section located here: Project Collaboration - Java Programming Forums
I would help you out here but I don't know much about file I/O in java. Sorry :(.
welcome to the java programming forums.
it thinks this will help you. it can give you ramdon numbers, so it can be used for password. :)
http://www.javaprogrammingforums.com...m-numbers.html
bout writing in a file, hmm, try to search for it. kinda busy.
but i will try to keep in touch. :)
Cheers,
Truffy
Hello pwngrammer, welcome to the forums :D
Don't forget about our Tips & Tutorials forum. There are lots of code snippets in there:
Java Tips & Tutorials - Java Programming Forums
This is what you need for writing a file:
http://www.javaprogrammingforums.com...sing-java.html
I will write an example application for you ASAP...
That forum is more for projects that we work on as a team. pwngrammer is just being lazy and asking for someone to do the work for him :-"
Try this pwngrammer:
Code :import java.io.*; import java.util.Random; public class Pwngrammer { /** * JavaProgrammingForums.com */ public static void main(String[] args) throws Exception { Random r = new Random(); Writer output = null; File file = new File("PasswordFile.txt"); output = new BufferedWriter(new FileWriter(file)); int password = 0; for(int a = 0; a < 4; a++){ password = (int)(9.0 * Math.random()) + 1; System.out.print(password); String myString = Integer.toString(password); output.write(myString); } output.close(); System.out.println(""); System.out.println("Password written to file."); } }
Im doing this one for fun now. Thank you to all of you for helping me out with both my programs. This one has a problem. Cannot find symbol-class Writer