• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Characters

 
Becky Miller
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Randall Twede
Ranch Hand
Posts: 4481
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic