here's another one that i've been struggling with. I need to create a phone number that can not have an 8 or a 9 in the area code.
I thought it would be smart to simply generate the area code one number at a time
..............
num1 = generator.nextInt(7)+ 1;
num2 = generator.nextInt(7)+ 1;
num3 = generator.nextInt(7)+ 1;
....................
my thought was that by setting next int to 7 that it would prevent any 8's or 9's from displaying.......and by using the +1 that it would keep any zeros from displaying.
well.....apparently thats not the way to go because when i test my program i do occassionally get 8s or 9s........but whats even worse is that sometimes i can get a 1 digit or a 2 digit area code. I dont understand why I'm getting 8's and 9's when i'm specifying in my range that they should not appear........and i definately dont understand why i'm not getting a 3 digit value to appear in my ouput.