Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define the isValidIpAddress and generateRandomIpAddress methods such that they work as described below: public static boolean isValidIpAddress(String testIpAddress) : This method takes an IP address
Define the isValidIpAddress and generateRandomIpAddress methods such that they work as described below:
- public static boolean isValidIpAddress(String testIpAddress): This method takes an IP address argument in textual form (i.e. 127.23.66.11). It should then examine this string and determine if it is in a proper IP Address format. This means it has four numbers in the range 0-255 each separated by a '.' and that there are no additional characters or symbols (no extra '.'s either). Your method should return true if it is valid, false otherwise. Note, that I am not expecting you to verify whether the IP address argument is a valid computer address or not, just whether it uses the proper format.
- public static String generateRandomIpAddress(): This method should generate random IP address and return it as a String. Note that for each of the four numeric components, they should be randomly chosen numbers in the range 0-255 with equal likelihood for each number.
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