Task 1: You are to build a doubly-linked list from ...



COP 3538 – Data Structures with OOP

Project 3: Summer 2012

Due: 10 July Start of Class

Doubly-Linked Lists, Interactive Inputs, Menus, and More

Objectives:

Provide additional experiences with interactive inputs input.

Provide additional exercises in learning UML (architectural design)

Provide exercises in developing detail design pseudocode

Provide exercises in Javadoc and its various formats

Provide exercises in building and processing a doubly-linked list of integers.

Using NetBeans 7.1, you are to write a Java program using OOP principles to accommodate the following functionality

Task 1: Overview. Build Double Linked List. You are to build a doubly-linked list from interactive input from the client (me). I will input an indeterminate number of integers (positive, negative, and 0.) You are to access my inputs one at a time and build a doubly-linked list such that the numbers are inserted in ascending order. I recommend that you use the Buffered Reader classes as in the past. Review my slides on Brief Introduction to I/O for sample code. Since you will not be computing with the integers, you may not need to execute parseInt to convert the input text to internal integers.

Task 2: Input Constraints: Once I start to test your program, you are to solicit inputs from me using a nice prompt that specifies I am to input an integer and to press Enter after each one. Accompanying this prompt must be a corresponding prompt that cites Inputting a -1 will terminate the inputting and building process. Reissue these two prompts after each input I provide to you.

The -1 will be a flag and is not to be inserted into a link. My input to you could contain only the -1, so you must anticipate this logic. I may / may not elect to test this feature.

There will be only one input stream from me so you do not have to anticipate that I will have more than one set of inputs to build the linked list. If I wish to re-execute your program with a second or third input stream of integers, I will re-execute your program from scratch.

Task 3: Display the Linked List. Upon receiving the -1, you are to display the doubly linked list with a nice header citing that this is the initial doubly-linked list. Output integers are to each appear left justified. Don’t forget that a negative number must be preceded with a negative sign. Upon concluding the linked list display, skip a line and print the number of links (nodes) produced, as in Number of Nodes in List: nn. Skip a line or two after this.

Task 4: Menu for Updating your Doubly-Linked List. After you display the linked list and the number of nodes printed, you are to develop and display a short menu (see format) with options to:

Update Menu

1. Delete First

2. Delete Last

3. Insert First

4. Insert Last

5. Delete Node

6. Insert Node After

7. Display Updated Linked List

8. Terminate

Then prompt me for my selection and that I must follow the selection by pressing Enter.

Task 5: Processing the Menu Selections. I will select a number (1 through 8 and press Enter). For choices 1 and 2, you are to accommodate the appropriate function and display the item deleted with an appropriate header (citing the choice followed by the displayed inserted item) and spacing. Upon displaying the results of your processing, ask if I want to continue. Accept a Y or an N. If Y, you then must prompt me for my next choice. In N, interpret this as an * and Terminate.

For choices 3-5 submitted to you, you are required to prompt me to input the value of the (new) node to be inserted or deleted. You must read my input and take appropriate action. Display the action taken appropriately and the node inserted or deleted. If the new First is not less than the current First or the new Last is not greater than the current Last, or the node to be deleted cannot be found, please display a message to that effect. Upon displaying the results of your processing, ask if I want to continue. Accept a Y or an N. If Y, you then must prompt me for my next choice. In N, interpret this as an 8 and Terminate.

For choice 6 submitted to you, you are required to prompt me to input the value of the node to be inserted and the value of the node that this new node is to be inserted after. Issue two prompts and read two values. Undertake appropriate processing and display the results in a format outlined above. . Upon displaying the results of your processing, ask if I want to continue. Accept a Y or an N. If Y, you then must prompt me for my next choice. In N, interpret this as an 8 and Terminate.

For choice 7, you are to display the updated linked list using both forward links and with backward links, as in task 3 above. Separate each display with a couple of spaces and be certain to have an appropriate header describing the contents to follow. Do not display the updated linked list until I enter a 7. After this display, prompt me for my next choice, as described above. Accept a Y or an N. If Y, you then must prompt me for my next choice. In N, interpret this as an 8 and Terminate

Upon choice 8, you are to print out That’s All Folks! and terminate.

Task 6: Error Conditions. Bonus: 15 points if you include this feature. You must tell me in the menu line that you accommodate error conditions. Error conditions: functions such as deleting a node not present, inserting a new first that is not less than the current first, inserting a new Last that is not greater than the current Last, not being above to Insert and, lastly, attempting to add a duplicate. After a node because the node to be inserted after cannot be found, etc. you are to display the input and an appropriate message. Then solicit (prompt) me for my next input.

This program reflects a change of pace and should be lots of fun. Javadoc, UML, and especially pseudo-code is a must on this assignment.

Above all, start early and have fun.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download