Scenario: IPv4 addresses (used to communicate on a network) have 4 numbers with 3 decimal points between them with each number being called an octet. For example, 1.2.3.4. 1 is an octet, 2 is an octet, and so on. The first octet has to have values between 1-255 while the 2nd-4th octets can have values between 0-255. The IP addresses are divided into classes A, B, C, D and E based upon the value of the first octet. See the table below. Students preparing for the CompTIA A+ certification (those taking CTS1131 Computer Home/Small Office Essentials and CTS1132 PC Technician who are majoring in CIT, Networking or IT Security) will have the following options to choose from in preparing to study these concepts and need to focus on class A, B and C: 1. Identify the class: Given an IP address, the user answers with an "A", "B" or "C". 2. Provide the default subnet mask: Given an IP address, the user answers with the appropriate default subnet mask. 3. Exit: The program ends. Once the user selects one of the options, it will initially state what option it is and provide the question related to that option. When the user types in an answer, the program will tell them whether they were correct or incorrect and then give them another question. If the user types in "q", it will take them back to the main menu. If the user hits Enter without typing anything, the user is re-prompted with the same prompt. Class Octet Range Default Subnet Mask A 1-127* 255.0.0.0 B 128-191 255.255.0.0 C 192-223 255.255.255.0 *127 is loopback and some people do not consider it to be part of class A. For the purposes of this assignment, it'll be part of Class A. Create the python program that solves the problem in the scenario. Make sure to format it as seen in the screenshot below. Formatting means the prompts for the user should be spelled and written the same way as seen in the screenshot as well as the spacing between outputs (single-spaced, double-spaced, etc.) should also match. Make sure variable values are formatted the same way as seen in the screenshot.   Any task that will be repeated over and over should be put in its own function. Each function should logically do one thing and only that well. Make sure to divide your program appropriately into functions. Any program that doesn't use functions or only uses one function (such as a main function) You MUST create and use the following functions EXACTLY as specified as the instructor will review this methods but also run test cases against them: whatClass(address) - where address is the IP address (as a string) and the function returns a string result of whether the given IP address is a Class "A", "B" or "C" address. It should only return the letter of the class as a string. whatSM(address) - where address is the IP address (as a string) and the function returns the result of the subnet mask for the given IP address. generateRandomIP() - which generates a random IP address and returns it (as a string). Make sure to follow good programming practices as mentioned in Good and Bad Programming Practices. You should only use modules/libraries we have covered thus far. If the program doesn't put the code appropriately into functions,  The portions above in red italics describing the functions were added to clarify for this new due date. Note: address must be a string and when a random IP address is generated, it should be a string.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Scenario: IPv4 addresses (used to communicate on a network) have 4 numbers with 3 decimal points between them with each number being called an octet. For example, 1.2.3.4. 1 is an octet, 2 is an octet, and so on. The first octet has to have values between 1-255 while the 2nd-4th octets can have values between 0-255. The IP addresses are divided into classes A, B, C, D and E based upon the value of the first octet. See the table below. Students preparing for the CompTIA A+ certification (those taking CTS1131 Computer Home/Small Office Essentials and CTS1132 PC Technician who are majoring in CIT, Networking or IT Security) will have the following options to choose from in preparing to study these concepts and need to focus on class A, B and C:

1. Identify the class: Given an IP address, the user answers with an "A", "B" or "C".

2. Provide the default subnet mask: Given an IP address, the user answers with the appropriate default subnet mask.

3. Exit: The program ends.

Once the user selects one of the options, it will initially state what option it is and provide the question related to that option. When the user types in an answer, the program will tell them whether they were correct or incorrect and then give them another question. If the user types in "q", it will take them back to the main menu. If the user hits Enter without typing anything, the user is re-prompted with the same prompt.

Class Octet Range Default Subnet Mask
A 1-127* 255.0.0.0
B 128-191 255.255.0.0
C 192-223 255.255.255.0

*127 is loopback and some people do not consider it to be part of class A.

For the purposes of this assignment, it'll be part of Class A.

Create the python program that solves the problem in the scenario. Make sure to format it as seen in the screenshot below. Formatting means the prompts for the user should be spelled and written the same way as seen in the screenshot as well as the spacing between outputs (single-spaced, double-spaced, etc.) should also match. Make sure variable values are formatted the same way as seen in the screenshot.

 

Any task that will be repeated over and over should be put in its own function. Each function should logically do one thing and only that well. Make sure to divide your program appropriately into functions. Any program that doesn't use functions or only uses one function (such as a main function)

You MUST create and use the following functions EXACTLY as specified as the instructor will review this methods but also run test cases against them:

whatClass(address) - where address is the IP address (as a string) and the function returns a string result of whether the given IP address is a Class "A", "B" or "C" address. It should only return the letter of the class as a string.

whatSM(address) - where address is the IP address (as a string) and the function returns the result of the subnet mask for the given IP address.

generateRandomIP() - which generates a random IP address and returns it (as a string).

Make sure to follow good programming practices as mentioned in Good and Bad Programming Practices.

You should only use modules/libraries we have covered thus far.

If the program doesn't put the code appropriately into functions, 

The portions above in red italics describing the functions were added to clarify for this new due date. Note: address must be a string and when a random IP address is generated, it should be a string.

Welcome to the IPv4 Address Practice Program!

**Main Menu:**
1. Identify whether an IP Address is Class A, B, or C.
2. Identify what the subnet mask is for a given IP address.
3. Exit

**Choice:** 2

**Option 2 - Provide the default subnet mask.**

- What is the default subnet mask for 37.140.124.92 (q=quit)?  
  **255.0.0.0**  
  Correct!

- What is the default subnet mask for 141.27.69.81 (q=quit)?  
  **2**  
  Incorrect. The correct answer is: **255.255.0.0**.

- What is the default subnet mask for 163.195.171.160 (q=quit)?  
  **q**

**Main Menu:**
1. Identify whether an IP Address is Class A, B, or C.
2. Identify what the subnet mask is for a given IP address.
3. Exit

**Choice:** 1

**Option 1 - Identify the class.**

- What class (A, B, C) is 147.218.24.40 (q=quit)?  
  **B**  
  Correct!

- What class (A, B, C) is 69.172.2.216 (q=quit)?  
  **q**

**Main Menu:**
1. Identify whether an IP Address is Class A, B, or C.
2. Identify what the subnet mask is for a given IP address.
3. Exit

**Choice:** 3
Transcribed Image Text:Welcome to the IPv4 Address Practice Program! **Main Menu:** 1. Identify whether an IP Address is Class A, B, or C. 2. Identify what the subnet mask is for a given IP address. 3. Exit **Choice:** 2 **Option 2 - Provide the default subnet mask.** - What is the default subnet mask for 37.140.124.92 (q=quit)? **255.0.0.0** Correct! - What is the default subnet mask for 141.27.69.81 (q=quit)? **2** Incorrect. The correct answer is: **255.255.0.0**. - What is the default subnet mask for 163.195.171.160 (q=quit)? **q** **Main Menu:** 1. Identify whether an IP Address is Class A, B, or C. 2. Identify what the subnet mask is for a given IP address. 3. Exit **Choice:** 1 **Option 1 - Identify the class.** - What class (A, B, C) is 147.218.24.40 (q=quit)? **B** Correct! - What class (A, B, C) is 69.172.2.216 (q=quit)? **q** **Main Menu:** 1. Identify whether an IP Address is Class A, B, or C. 2. Identify what the subnet mask is for a given IP address. 3. Exit **Choice:** 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education