Locally, computers are often known by an alias (nickname) as well. You will design and write...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Locally, computers are often known by an alias (nickname) as well. You will design and write a program to process a list of Internet addresses from file "CS531_Inet.txt". Each line in "CS531_Inet.txt" will contain an addresses/alias pair as shown below: Sample CS531_Inet.txt: 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 For this assignment, you will create your own test data file using the sample format. Grading will involve using different data files with the same format. Each address and each alias within the file is unique. Alias names are NOT case sensitive. Program structure and design: Create a structure type called address_t with components for the four integers of an IPv4 address along with a fifth component in which to store an associated alias (key field) of up to 10 characters. You will then create a singly linked list of address_t structures which will contain all of the address/alias pairs read in from the "CS531_Inet.txt" file. For this exercise, the linked list may be unsorted. Once the linked list 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) Save to file 8) Quit 1) Add address: Prompt user for an IPv4 address/alias pair. Both data elements are read in from the keyboard as character strings. The address string will be parsed and the four component integers will be stored separately (hint: use sscanf()). Each of the four component integers must be within the range: [0-255]. If any component integers are out of range, display an error message and re-prompt for a new address. If the alias has a strlen() value>10, display an error message, and re-prompt. If either the address or alias already exists within the list, display an error message and redisplay the menu. 2) Look up Address: Prompt user for an alias, and display the corresponding address. If the alias does not exist within the list, display an error message and redisplay the menu. 3) Update address: Prompt user for an alias and display the corresponding address. Allow user to update the address and have the newly entered address replace the old address within the linked list assuming the new address does not already exist within the list. Each of the four component integers must be within the range: [0-255]. If any component integers are out of range, display an error message and re-prompt for a new address. If the alias does not exist within the list, or the newly entered address is a duplicate, display an error message and redisplay the menu. 4) Delete address: Prompt user for an alias, and display the corresponding address. Confirm that user wishes to delete this node from the linked list. If the alias does not exist within the list, display an error message and call displayList() in order to show user the current alias/address pairs within the list. Then redisplay the menu. 5) Display list: Display all address/alias pairs within the list. For this exercise, the list is unsorted. If the list is empty, print a message to that effect and redisplay the menu. Also display the number of nodes within the list. 6) Display aliases for location: Prompt user for an address location. (i.e. two separately entered values between 0-255). If either value is out of range, re- prompt. List all aliases that map to this location. If the location does not exist within the list, display an error message and redisplay the menu. 7) Save to file: Prompt user for a file name, and save the revised list to the specified file keeping file format consistent with that of the input file (i.e. one address/alias pair per line.) 8) Quit: Exit program You may have one global variable as follows: struct address_t { int octet[4]; char alias[11]; struct address_t *next; } struct address_t *head = NULL; Locally, computers are often known by an alias (nickname) as well. You will design and write a program to process a list of Internet addresses from file "CS531_Inet.txt". Each line in "CS531_Inet.txt" will contain an addresses/alias pair as shown below: Sample CS531_Inet.txt: 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 For this assignment, you will create your own test data file using the sample format. Grading will involve using different data files with the same format. Each address and each alias within the file is unique. Alias names are NOT case sensitive. Program structure and design: Create a structure type called address_t with components for the four integers of an IPv4 address along with a fifth component in which to store an associated alias (key field) of up to 10 characters. You will then create a singly linked list of address_t structures which will contain all of the address/alias pairs read in from the "CS531_Inet.txt" file. For this exercise, the linked list may be unsorted. Once the linked list 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) Save to file 8) Quit 1) Add address: Prompt user for an IPv4 address/alias pair. Both data elements are read in from the keyboard as character strings. The address string will be parsed and the four component integers will be stored separately (hint: use sscanf()). Each of the four component integers must be within the range: [0-255]. If any component integers are out of range, display an error message and re-prompt for a new address. If the alias has a strlen() value>10, display an error message, and re-prompt. If either the address or alias already exists within the list, display an error message and redisplay the menu. 2) Look up Address: Prompt user for an alias, and display the corresponding address. If the alias does not exist within the list, display an error message and redisplay the menu. 3) Update address: Prompt user for an alias and display the corresponding address. Allow user to update the address and have the newly entered address replace the old address within the linked list assuming the new address does not already exist within the list. Each of the four component integers must be within the range: [0-255]. If any component integers are out of range, display an error message and re-prompt for a new address. If the alias does not exist within the list, or the newly entered address is a duplicate, display an error message and redisplay the menu. 4) Delete address: Prompt user for an alias, and display the corresponding address. Confirm that user wishes to delete this node from the linked list. If the alias does not exist within the list, display an error message and call displayList() in order to show user the current alias/address pairs within the list. Then redisplay the menu. 5) Display list: Display all address/alias pairs within the list. For this exercise, the list is unsorted. If the list is empty, print a message to that effect and redisplay the menu. Also display the number of nodes within the list. 6) Display aliases for location: Prompt user for an address location. (i.e. two separately entered values between 0-255). If either value is out of range, re- prompt. List all aliases that map to this location. If the location does not exist within the list, display an error message and redisplay the menu. 7) Save to file: Prompt user for a file name, and save the revised list to the specified file keeping file format consistent with that of the input file (i.e. one address/alias pair per line.) 8) Quit: Exit program You may have one global variable as follows: struct address_t { int octet[4]; char alias[11]; struct address_t *next; } struct address_t *head = NULL;
Expert Answer:
Related Book For
Intermediate Accounting
ISBN: 978-0470161012
9th Canadian Edition, Volume 2
Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield.
Posted Date:
Students also viewed these programming questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
The Depression Anxiety Stress Scales (DASS) is a tool to measure the depression, anxiety and stress levels of individuals. For measuring the stress level, the DASS score ranges from 0 to 42 and a...
-
Avnet is one of the world's largest value-added distributors of electronic components, enterprise computer and storage products, IT services and embedded subsystems. Avnet creates a vital link in the...
-
Suppose a Walmart store in Fillmore, Missouri, ended January 2018 with 900,000 units of merchandise that cost $5 each. Suppose the store then sold 50,000 units for $510,000 during February. Further,...
-
In 2013, Thomas DePrince, a passenger aboard a cruise ship, visited the ships jewelry boutique, operated by Starboard Cruise Services, Inc. DePrince told the employees of the boutique that he was...
-
Wilco Corporation has the following account balances at December 31, 2012. Share capitalordinary, $5 par value ....$ 510,000 Treasury shares ..............90,000 Retained earnings...
-
Discuss the breath of responsibilities required of a radiographer. List the five main areas of responsibility in each specialty of radiologic technology. Discuss advantages to working in each of the...
-
A 115 mCi radioactive tracer is made in a nuclear reactor. When it is delivered to a hospital 16 hours later its activity is 95 mCi. The lowest usable level of activity is 10 mCi. a. What is the...
-
Introduce the Rocky Mountain Psychological Services and provide general background information based on your independent search (i.e., not contacting the company representative). Some of the areas...
-
Assume you are the HR manager responsible for keeping your organization's employee handbook updated. What process would you use to do so? How would you provide employees with the updated information?
-
You need to capture the article's main points and discuss them lucidly, in a well-developed fashion. Students will be evaluated on the quality of participation based on relevancy, insight, evidence,...
-
Question 1 A. The only true champagne comes from the champagne region in France. With this in mind: A. Explain the history of champagne production. Limit your answer to TWO (2) pages. B. Outline...
-
You work as the Lead BA for Husky Airlines, a global airline operating in North America, Latin America, Europe, and Asia. The airline is going through strategic planning and wants your help in...
-
How much CrCl 3 5H 2 O is needed to prepare 1.00 L of solution containing 20.0 g Cr 3+ per L What will be the concentration of the Cl - ions?
-
The maximum pressure that can be developed for a certain fluid power cylinder is 15.0 MPa. Compute the required diameter for the piston if the cylinder must exert a force of 30 kN.
-
The following is the shareholders equity section of Suozzi Corp. at December 31, 2012: Preferred shares, a authorized 100,000 shares; issued 25,000 shares $ 750,000 Common shares (200,000...
-
Howard Corporation earned $480,000 during a period when it had an average of 100,000 common shares outstanding. The common shares sold at an average market price of $23 per share during the period....
-
Brondon Corp. purchased a put option on Mykia common shares on July 7, 2011, for $480. The put option is for 350 shares, and the strike price is $50. The option expires on January 31, 2012. The...
-
Cinnamon, Inc. recorded a total deferred tax asset in Year 3 of \($12\),301, off set by a \($12\),301 valuation allowance. Cinnamon most likely: A . fully utilized the deferred tax asset in Year 3. B...
-
Midland Brands issues three-year bonds dated January 1, 2015 with a face value of $5,000,000. Th e market interest rate on bonds of comparable risk and term is 3%. If the bonds pay 2.5% annually on...
-
A company issues $1,000,000 face value of 10-year bonds on January 1, 2015 when the market interest rate on bonds of comparable risk and terms is 5%. Th e bonds pay 6% interest annually on December...
Study smarter with the SolutionInn App