|
|
@@ -1,6 +1,7 @@
|
|
1
|
1
|
package com.zipcodewilmington.phone;
|
|
2
|
2
|
|
|
3
|
3
|
import com.zipcodewilmington.exceptions.InvalidPhoneNumberFormatException;
|
|
|
4
|
+import com.zipcodewilmington.tools.RandomNumberFactory;
|
|
4
|
5
|
|
|
5
|
6
|
import java.util.logging.Level;
|
|
6
|
7
|
import java.util.logging.Logger;
|
|
|
@@ -35,10 +36,9 @@ public final class PhoneNumberFactory {
|
|
35
|
36
|
* @return an instance of PhoneNumber with randomly generated phone number value
|
|
36
|
37
|
*/ //TODO - Implement logic
|
|
37
|
38
|
public static PhoneNumber createRandomPhoneNumber() {
|
|
38
|
|
- int areaCode=(int)(Math.random()*900+100);
|
|
39
|
|
- int centralOfficeCode=(int)(Math.random()*900+100);
|
|
40
|
|
- int phoneLineCode=(int)(Math.random()*9000+1000);
|
|
41
|
|
-
|
|
|
39
|
+ int areaCode=RandomNumberFactory.createInteger(100,999);
|
|
|
40
|
+ int centralOfficeCode=RandomNumberFactory.createInteger(100,999);
|
|
|
41
|
+ int phoneLineCode=RandomNumberFactory.createInteger(1000,9999);
|
|
42
|
42
|
return createPhoneNumberSafely(areaCode, centralOfficeCode, phoneLineCode);
|
|
43
|
43
|
}
|
|
44
|
44
|
|