Question: Homework # 3 builds upon Homework # 2 . Recall that in HW# 2 , our program reads the contents of datafile CS 5 3

Homework # 3 builds upon Homework # 2. Recall that in HW#2, our program reads the contents of datafile CS531_Inet.txt. Each line in CS531_Inet.txt contains an IPv4 address and alias pair as shown below: (sample CS531_Inet.txt includes errors) In HW#2, you were asked to construct a linked list of address_t structures, each of which contained the four integers of an IPv4 address along with a fifth component in which to store an associated alias of up to 10 characters. In this project, you will replace the linked list with a Binary Search Tree (BST). All edit checks for HW#2 apply to HW#3 regarding range checking for the IPv4 octets [0,255] and alias length [1,10] printable characters. For this exercise, the CS531_Inet.text file may have errors. If any of the following errors occur within the CS531_Inet.txt file, the record must be written out to the text file: CS531_error-log (see test case example), and omitted from the BST. Possible errors within CS531_Inet.txt may include: IPv4 address does not parse into four legal integers. The alias length is greater than ten characters (note:
is not a legal character within an alias). The alias contains one or more uppercase letters. Again, you will create a structure type called address_t similar to that used in HW#2, with the following modifications needed to convert the linked list to a BST.111.22.3.44 platte 131.250.95.21 jet 172.66.7.88 wabash 111.22.5.66 green 131.250.47.63 baker As with HW#2, for this assignment, you will create your own test data files using the sample format. Grading will involve using different data files with the same format. 111.22.3.44 platte 131.250.95.21 jet 131.350.3.4.5 smith 172.66.7.88 wabash 111.22.5.66 green 172.333.32.5 smith2131.250.47.63 baker 111.22.5.77 abercrombie 131.250.62.33 Sanders struct address_t { int octet[4]; char alias[11]; struct address_t *leftChild,*rightChild,*parent; int height, depth; } struct address_t *head = NULL; As CS531_Inet.txt is being read in, those records that do not contain errors will be stored in the BST composed of address_t structures containing the address/alias pairs read in from the file. Once the BST has been created, the user will receive the following menu options: 1) Add address 2) Look up address 3) Update address 4) Delete address 5) Display list 6) Display aliases for location 7) Display Error Log 8) Quit Program Structure and Design displayList() and displayAliasesForLocation() shall be based on Inorder Traversal. displayList() will display the alias, address, height, depth, and parents alias for each node. deleteAddress(), lookUpAddress(), and displayAliasesForLocation() will display an error message if the alias (or location) entered is not listed. Following the error message, the menu will be redisplayed. A separate UDF will be defined as an entry point for each menu option. These 8 functions must each be properly prototyped and documented as discussed. No duplicate aliases or address are allowed. If attempted, display an appropriate error message followed by the menu. For this exercise, all aliases entered by the user must be converted (by your program) to lower case. testcase scenarios:1) Add address 2) Look up address 3) Update address 4) Delete address 5) Display list 6) Display aliases for location 7) Display Error Log 8) Quit 111.22.3.44 platte 131.250.95.21 jet 131.350.3.4.5 smith 172.66.7.88 wabash 111.22.5.66 green 172.333.32.5 smith2131.250.47.63 baker 111.22.5.77 abercrombie 131.250.62.33 Sanders Enter menu option: 5 baker 131.250.47.63 height:0 depth:3 parent:green green 111.22.5.66 height:1 depth:2 parent:jet jet 131.250.95.21 height:2 depth:1 parent:platte platte 111.22.3.44 height:3 depth:0 parent: NONE wabash 172.66.7.88 height:0 depth:1 parent:platte (note that option 5 displays the list in alphabetical order, due to the inorder traversal) Enter menu option: 6 Enter Locality: 131.250 Location: 131.250 baker jet Enter menu option: 2 Enter alias: platte platte: 111.22.3.44 Enter menu option: 1 Enter IPv4 address: 131.250.42.18 Enter alias: barbara Enter menu option: 5 baker 131.250.47.63 height:1 depth:3 parent:green barbara 131.250.42.18 height:0 depth:4 parent:baker green 111.22.5.66 height:2 depth:2 parent:jet jet 131.250.95.21 height:3 depth:1 parent:platte platte 111.22.3.44 height:4 depth:0 parent: NONE wabash 172.66.7.88 height:0 depth:1 parent:platte Enter menu option: 6 Enter Locality: 131.250 Location: 131.250 baker barbara jet Enter menu option: 7 Error Log: 131.350.3.4.5 smith 172.333.32.5 smith2111.22.5.77 abercrombie 131.250.62.33 Sanders Enter menu option: 8 Goodbye!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!