File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Characters" Watch "Characters" New topic
Author

Characters

Becky Miller
Greenhorn

Joined: Jan 24, 2001
Posts: 17
I need to write a program to generate a random sequence of capital letters that does not include vowels.

So far I only have this

public class Letters{
public static void main(String [] args)
{
symbol= (char)(26.0 * Math.random());
}
}
can anyone help?
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

char ch;
ch = (char) (65 + (Math.random() * 26));
Well the function above generates pseudo random capital letters. In terms of the non-vowel requirement - beats me.
[This message has been edited by Pho Tek (edited February 18, 2001).]


Regards,

Pho
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

It seems to me you will have to check for the specific numbers that represent those letters. I dont have a table of them but what I would probably do is use a switch statement. Capital A would apparently be 65

not a complete solution but should give you an idea.


SCJP
Visit my download page
 
wood burning stoves
 
subject: Characters