I display the random number works so far just print out the random number, and make it positve.
Please advise
1. How do I format to get xxx-xxx-xxxx
2. How do I get the first set not including 8 , 9 and the sum of 3 digit in the second set < 742.
Your help is greatly appreciated.
-----------------------------------------------------------
import java.util.Random;
import java.text.*;
public class Telephone
{
public static void main (
String [] args)
{
Random generator = new Random ();
int num , formatNum, num2;
num = generator.nextInt();
//formatNum = Math.abs(num);
NumberFormat nf = NumberFormat.getInstance();
num2 = nf.parse(formatNum);
System.out.println ("A random telephone number is " + num2);
}
}
