This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Looking For A Solution!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Looking For A Solution!!!!!! " Watch "Looking For A Solution!!!!!! " New topic
Author

Looking For A Solution!!!!!!

Khalid Askar
Greenhorn

Joined: Dec 25, 2004
Posts: 2
Hello every one!

I am new to the java programming language and I need a solution for the below exercise.

Q-Write a program to generate a random sequence of capital letters that does not include vowels?


Thanks in advance,
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
since this sounds like a assignment i give you some hints instead of the full solution:

- Math.random() produces a random number between 0 and 1. You can multiply/round/cast this number to get a valid index to an array
- You could create an char[] with all the required letters (something like {'B', 'C'})


pascal
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Another first post! Welcome aboard!

Pascal's answer is typical in the beginner forum ... just enough hints to get you going, but not complete solutions. Please give it a try and feel free to post code as you make progress or run into trouble.

If you're not familiar with the JavaDoc, this is a great resource. Bookmark it today: http://java.sun.com/j2se/1.5.0/docs/api/
[ January 03, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Looking For A Solution!!!!!!
 
It's not a secret anymore!