I am to create a random phone number generator with specific restrictions, as shown in the commented section in the beginning, and I have everything but the first three digits working. I can get them to work separately, but I am not supposed to do it that way...the following is my most recent attempt.

/* Do not let the first three digits contain an 8 or 9. Make sure that the second set of 3 digits is not greater than 742. Do not determine each digit seperately. */

class PhoneNumber

{

public static void main(String args[])

{

for(int i = 1; i == 10; i++);

{

int z = 0;

for(int i = 0; i == 3; i++);

{

z = (int) (Math.random()*7) + 1;

if(z <= (int) 7)

{

System.out.println(z);

}

if(z == (int) 8)

{

z--;

}

if(z == (int) 9)

{

z--;

z--;

}

System.out.println(z+""+z+""+z);

}

int x = 0;

for(int i = 1; i <= 1; i++);

{

x = (int) (Math.random()*643) + 100;

}

int c = 0;

for(int i = 1; i <= 1; i++);

{

c = (int) (Math.random()*8999) + 1000;

}

System.out.println(z+""+z+""+z+"-"+x+"-"+c);

}

}

}

}

/* Do not let the first three digits contain an 8 or 9. Make sure that the second set of 3 digits is not greater than 742. Do not determine each digit seperately. */

class PhoneNumber

{

public static void main(String args[])

{

for(int i = 1; i == 10; i++);

{

int z = 0;

for(int i = 0; i == 3; i++);

{

z = (int) (Math.random()*7) + 1;

if(z <= (int) 7)

{

System.out.println(z);

}

if(z == (int) 8)

{

z--;

}

if(z == (int) 9)

{

z--;

z--;

}

System.out.println(z+""+z+""+z);

}

int x = 0;

for(int i = 1; i <= 1; i++);

{

x = (int) (Math.random()*643) + 100;

}

int c = 0;

for(int i = 1; i <= 1; i++);

{

c = (int) (Math.random()*8999) + 1000;

}

System.out.println(z+""+z+""+z+"-"+x+"-"+c);

}

}

}

}

### Recently Asked Questions

- Chain rule (square roots). Find the derivative of f(x). f(x)=sqrt 6x^3+4x-8

- Inclusion Exclusion Principle Counting by complement is a technique for counting the number of elements in a set S that have a property by counting the total

- One of the worst cases of aquatic pollution occurred on March 24, 1989, when the oil tanker Exxon Valdez ran into a reef in Prince William Sound, Alaska,