Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a method to decide whether a string contains a valid IPv 6 address in the preferred format ( each h represents a hexadecimal digit
Write a method to decide whether a string contains a valid IPv address in the preferred
format each represents a hexadecimal digit:
hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh
your method must loop through individual characters in the string.
Approaches using regular expression andor API classes like Pattern, Matcher will
receive zero credit.
Your program ie your class will have two methods, the actual method and a main
Start with a method stub like the one below. The main will be used to test your method
with different data see ch Unit testing
Here are examples of valid and invalid IPv addresses:
Valid:
::ab:cdef:::Ab:cDEf
:::dddd:eee:dddd:eeee:ffff
:::::::
Invalid:
::ab:cdef:::ab:cdef not hex digits in and last
groups
:: not enough digitsgroups
hg::ab:cdef:::ab:cdef nonhex digits in the group
:::b:cdef:::ab:cdef two colons together
Use a proper incremental development strategy to build your program. It is a good idea to
first check whether the parameter string is of the right length.
Follow the unit testing examples to add at least more testing cases of your choice to
your main: valid address and invalid ones.
When you are done, include a screenshot of the execution of your program in your
assignment report document. If it works properly, your program should only print those
two lines:
Testing started
Testing completed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started