Answered step by step
Verified Expert Solution
Link Copied!

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 IPv6 address in the preferred
format (each h 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 and/or API classes like Pattern, Matcher will
receive zero credit.
Your program (i.e. your class) will have two methods, the actual method and a main(.
Start with a method stub like the one below. The main(0 will be used to test your method
with different data (see ch6.7 Unit testing).
Here are examples of valid and invalid IPv6 addresses:
Valid:
0123:4567:89ab:cdef:0123:4567:89Ab:cDEf
0000:0000:0000:dddd:eee:dddd:eeee:ffff
0000:0000:0000:0000:0000:0000:0000:0000
Invalid:
123:4567:89ab:cdef:0123:4567:89ab:cdef0-> not 4 hex digits in 1st and last
groups
0000:0000:0000 not enough digits/groups
01hg:4567:89ab:cdef:0123:4567:89ab:cdef non-hex digits in the 1st group
0123:4567::89b:cdef:0123:4567:89ab: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 3 more testing cases of your choice to
your main(): 1 valid address and 2 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.
image text in transcribed

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Why do managers need accurate product cost information?

Answered: 1 week ago

Question

Why would a person fear success?

Answered: 1 week ago

Question

In your own words, summarize the primary objectives of unions.

Answered: 1 week ago