This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Code Generator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Code Generator" Watch "Java Code Generator" New topic
Author

Java Code Generator

Rafael Lopz
Greenhorn

Joined: Jan 15, 2010
Posts: 3
Hey guys, i'm new to Java. I need some help with this program.
What i need it to do is to make the number of codes the user sets, with upper-case and lower case letters and numbers, the number of chars the code has, the limits he inputs( for ex. 1st char a~f, 2nd char 1~9, etc) and at the end show the chars of each code all together.



So lets say the user wants 10 codes, with 5 chars each, 1st char a~d, 2nd 1~9 etc
And get something like a6ed4.

Thanks in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
What does the code do now? What difficulties are you having in making it do what you want it to do?


Ping & DNS - my free Android networking tools app
Rafael Lopz
Greenhorn

Joined: Jan 15, 2010
Posts: 3
It generates the code,limits it but doesnt get it all together in the end. I can't get it to do that.
I was trying to do an array there and at the end but it didn't work o:
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
You'll need to be more specific; what does "get it all together in the end" mean? What's the output now, and what should the output be? What have you tried to get it to do that?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11448
    
  16

Part of being a programmer is learning how to communicate with users, programmers, and machines in a VERY precise way. saying "it doesn't work" is useless and meaningless. Saying "When I run it, i expect output 'A', but get output 'B'" explains a LOT and helps others understand what you are talking about. The easier you make it for someone to help you, the more likely someone will.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Rafael Lopz
Greenhorn

Joined: Jan 15, 2010
Posts: 3
Sorry for not answering sooner but my internet connection hasnt been too good lately.

Meanwhile, i've been working on it and it's like this now:



Here's the output:

How many chars?
3
1º Pos letter[1] or number[2]?
1
Char Limit 1 - Start
a
Char Limit 1 - end
z
2º Pos letter[1] or number[2]?
2
Number Limit 2 - Start
1
Number Limit 2 - End
9
3º Pos letter[1] or number[2]?
1
Char Limit 3 - Start
a
Char Limit 3 - end
z
How many codes do you want?
5
pw - c3
pw - v1
pw - b9
pw - d4
pw - b7


Supposedly it should show a 3 chars password. Something like:

How many chars?
3
1º Pos letter[1] or number[2]?
1
Char Limit 1 - Start
a
Char Limit 1 - end
z
2º Pos letter[1] or number[2]?
2
Number Limit 2 - Start
1
Number Limit 2 - End
9
3º Pos letter[1] or number[2]?
1
Char Limit 3 - Start
a
Char Limit 3 - end
z
How many codes do you want?
5
pw - c3(letter)
pw - v1(letter)
pw - b9(letter)
pw - d4(letter)
pw - b7(letter) etc etc.


Can you guys understand it?

Thanks
 
 
subject: Java Code Generator