2 Ocak 2013 Çarşamba

Generating Phone Number

import java.util.Random;

public class odev2 {

/**

*

*/

public static void main(String[] args) {

 Random rnd = new Random();

System.out.println(“Welcome , Generating Phone Number”);

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


int addn = rnd.nextInt(10);


int firstn = rnd.nextInt(6)+2;

int secn = rnd.nextInt(90)+10;

int thirt = rnd.nextInt(643)+100;

int five = rnd.nextInt(100);

int six = rnd.nextInt(100);




 System.out.print(firstn);

 System.out.print(secn );

 System.out.print(” ” + thirt );

 if (five < 10 )

 System.out.print( ” 0” + five);

 else

 System.out.print( ” ” + five);



 if (six < 10 )

System.out.print( ” 0” + six );

 else

 System.out.print( ” ” + six);

}



}

}

Hiç yorum yok:

Yorum Gönder