Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For Programming Assignment 1, we are going to code Phase 1 of an IPv4 Address Checker. This script requires loops (while and for) and if

For Programming Assignment 1, we are going to code Phase 1 of an IPv4 Address Checker. This script requires loops (while and for) and if statements and the ability to work with Strings. We are going to use a sentinel value loop (while loop) to ask the user if they want to run the program by entering an IPv4 address or N to stop the program. Within the sentinel value loop, we are going to check for the following requirements:The length of the IPV4 address must be between 7 and 15 charactersThe IPV4 address has no characters other than dots (.) and numbers.There must be 3 dots (.) in the IPV4 address.When the user enters a valid IPv4 address, display the following message:Your IPV4 address has a correct length, numbers, and three dots.Then ask them if they want to run the program again.When the user enters an IPv4 address that is an incorrect length, display the following message where you replace the ___ with the length of the IPv4 address entered.Invalid length. Your IPv4 address has a length of ___ .The length of the IPv4 address must be between 7 and 15 characters.Then give them a chance to try again.When the user enters an IPv4 address that has fewer than 3 dots, display the following message where you replace the ___ with the invalid count of dots:Invalid count of dots is ___.Then give them a chance to try again.When the user enters an invalid character, you do not have to check the remaining characters in the string. One invalid character is enough. Display the following message and break if needed.Invalid character was found.Then give them a chance to try again.In case it isn't clear, any time your user enters an invalid IPV4 address that doesn't meet the requirements, print the Invalid message for whatever error they have made. If they have made more than 1 error, print the invalid message for each type of error made, and give them a chance to try again. Any time your user enters a valid IPV4 address, confirm that it is okay, and ask them if they want to run the program again or not as shown in the test cases.

Below is how the program will run and test cases to test the functionality of each requirement. Your program must follow these requirements so as to prevent you from the temptation of picking up a similar program on the Internet and submitting it as your own work. No regular expressions are allowed because I want to assess your ability to use loops, if statements, and work with Strings. Use the test cases of the program as shown below to check for valid and invalid entries based on what we are able to do _at this point in the class. You do not have to add additional test cases. (We will add more functionality in a later assignment.) Remember that your program should detect valid IPV4 addresses, and invalid IPV4 addresses that have the wrong length, less or more than 3 ...dots, and invalid characters no matter which order in which the user enters valid or invalid addresses. (Your program does not have to check for invalid patterns such as 12...3456 yet. We will do that later.) User input is shown in RED:This is an IPv4 address checker.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter an IPv4 address to run the program or Q to quit.10.10.10.10Your IPv4 address has a correct length, numbers, and three dots.This is an IPv4 address checker. Please enter an IPv4 address to run the program or Q to quit.255.255.255.255Your IPv4 address has a correct length, numbers, and three dots.This is an IPv4 address checker. Please enter an IPv4 address to run the program or Q to quit.1.1.1.Invalid length. Your IPv4 address has a length of 6 .The length of the IPv4 address must be between 7 and 15 characters.Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):255.255.255.2555Invalid length. Your IPv4 address has a length of 16 .The length of the IPv4 address must be between 7 and 15 characters.Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.

The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):10.10.10255Invalid count of dots is 2 .Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):10.a.10.255Invalid character was found.Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):10101010Invalid count of dots is 0 .Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):10.a.10Invalid character was found.Invalid count of dots is 2 .Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):1.aInvalid length. Your IPv4 address has a length of 3 .

The length of the IPv4 address must be between 7 and 15 characters.Invalid character was found.Invalid count of dots is 1 .Let's try again.This IPv4 address checker is checking for the following:The length of the IPv4 address must be between 7 and 15 characters.The IPv4 address has no characters other than dots and numbers.There must be 3 dots in the IPv4 address.Please enter the IPv4 address (example: 10.1.1.1):10.255.10.255Your IPv4 address has a correct length, numbers, and three dots.This is an IPv4 address checker. Please enter an IPv4 address to run the program or Q to quit.QThanks for using our IPv4 address checker. We are adding more features in the future.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions