p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Java 2 (http://p2p.wrox.com/forumdisplay.php?f=30)
-   -   Capital Letters no Vowels. (http://p2p.wrox.com/showthread.php?t=2722)

endamist August 12th, 2003 05:09 PM

Capital Letters no Vowels.
 
I'm still beating my head against the wall on this program exercise at the end of chapter 3. excercise 4. wrtie a program that generates a random sequesnce of capital letters that does not include vowels.

I've tried several diffrent ways of writing this program, even tried to re-write the examples that involved letterchecking from the book. Has anyone else tried this one successfully? maybe I'm just missing something or over looking something because I'm trying to hard or because I've been at it to long today, so for now I'm gonna leave it be and come back to it later and if I still don't get it perhaps someone else will post something here that will help me see what Im missing.

Thanks
endamist


endamist August 12th, 2003 05:59 PM

Grrr. I knew the minute I posted this topic I would end up figuring out what I was over looking. I wrote the program with a do while loop and kept getting an infinte loop and couldn't figure out why. the problem was what I was testing to be true. I tested for if the symbol was lowercase if this was true the loop would continue, I also tested for specific vowels, symbols lower than A or greater than Z and symbols lower than a or greater than z. It was the test for lower than a or greater than z that was not needed in the program because capital letters would either be lower than lower case letters or greater than and this was creating a situation that would continuously be true and thus the loop would never end. Once I took that test out of the program I had no problem getting it to produce a single capital letter that did not include vowels.

Now all I have to do is get it to produce a sequence of capital letters that do not include vowels which should be easyer now that I've got the basic part of the program to do what I wanted it to do.

Figures that it was something simple I was overlooking... it always is with programs... something simple.

Endamist



All times are GMT -4. The time now is 06:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.