Create a random phone number generator with specific


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);
}
}
}

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Create a random phone number generator with specific
Reference No:- TGS0144615

Expected delivery within 24 Hours