Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 ( 30pts) : Create a class PhoneNumberChecker that checks the validity of a given phone number using Regular Expressions. Three countries are supported:

image text in transcribed
Problem 2 ( 30pts) : Create a class PhoneNumberChecker that checks the validity of a given phone number using Regular Expressions. Three countries are supported: Morocco, Spain and England. Define the following methods: - validateNumber0 first asks the user to input the country to which the phone number belongs (remember only three countries are supported). In case on an invalid country, the message "This country is not supported by our Phone Number Checker!" shall be displayed and the user shall be asked if he/she would like to retry again, if yes, the whole process will be repeated, if not, the program will exit with a Goodbye message. Then asks the user to input the phone number and invokes the appropriate validation method (see below). If the validation method returns false, the message (e.g. "You have typed an invalid Spanish phone number") is displayed. Otherwise, it displays (e.g. "This is a valid Moroccan phone number : 00212-6-45456567). Note: In the following, a phone number in the appropriate format with no hyphens is also valid. Please consider this in the RegEX, as well. - validateMorrocan0 that checks if the String passed as an argument is a valid Moroccan phone number* or not using RegEx. This function is static and returns a Boolean. - The phone number should have the following format: +2125/6/7xx xxxxxx or 002125/6/7xxxxxxxx - validateSpanisho that checks if the String passed as an argument is a valid Spanish phone number" or not using RegEx. This function is static and returns a Boolean. * The phone number should have the following format: +349xxxxxxxx or 00349xxxxxxxx - validateEnglish0 that checks if the String passed as an argument is a valid British phone number* or not using RegEx. This function is static and retums a Boolean. * The phone number should have the following format: +4420-xxrsxxx or 0044210

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago