Question: Name this program StuPreIPv 6 ) Each network device must be assigned an IP address. An IPv 6 ( IP address version 6 ) address
Name this program StuPreIPv Each network device must be assigned an IP address. An IPv
IP address version address is represented in the preferred format as eight groups of four
hexadecimal digits. A hexadecimal digit may be ~ or a ~ f or A ~ F The groups are separated
by colons : An example of an IPv address in the preferred format is:
:db:a:::ae::
Write a method to decide whether a string contains a valid IPv address in the preferred format each
h represents a hexadecimal digit:
hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh
For this assignment, 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
Returns true if the string parameter contains a valid IPv
address in the preferred format. Otherwise returns false.
public static boolean isValidPreferFormatIpvString address
return false;
for unit testing: test the method with different arguments
public static void mainString args
System.out.printlnTesting started ;
String str; store a test string
boolean expected; expected result of true or false for the test string
str ; an invalid string
expected false;
if isValidPreferFormatIpvstr expected
System.out.printlnTest: str failed";
str ::ab:cdef:::ab:cDEf"; valid
expected true;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
