Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java code for this ( note: do not use scanner for user input) SAMPLE RUNS PROVIDED BELOW: 1. Without using Java Collections/Containers, write a program
Java code for this (note: do not use scanner for user input)
SAMPLE RUNS PROVIDED BELOW:
1. Without using Java Collections/Containers, write a program that reads/stores integers into a linked list, storing them in the order read/inserted. Add an integer in the list only if it isn't in the list. In addition, create a method to delete a value (node) from the list; if the value is not in the list, print out an error message stating that it was not found and continue processing. Finally, terminate insertions into the list when the sentinel -9999 is encountered and display the contents of the list. In your sample run, be sure to demonstrate insertion, deletion, and displaying the contents of the list. 2. Design and implement a program using a linked list class from/using the Java Collections/Containers to create, manage, and retrieve information on a self-reorganizing list of names and telephone numbers When a node is created its ct is set to zero and it is placed at the first of the list. Every time a node is referenced, its ct is increased by 1 and when ct reaches 3 (a magic number?) the node should be deleted from its current place on the list, replaced at the head of the list, and its ct reset to 0 The program should recognize three commands, requested by the prompt CMD A Add a phone number. The program prompts for a name, and a telephone number Look up a number. The program prompts the user to input a name Change a phone number. The program prompts with name and a new phone number, printing an error message if the name does not exist in the list. Save the list to a file, as described below QQuit without saving, reverts back to the last saved version xit; save the list and exit the program The program should initialize itself from a text file of names and phone numbers (which contains a list of names and phone numbers that may initially be empty). When the command S is entered, the program should rewrite the file with the current form of the list. Additional Requirements a. Do not use the Scanner class for any part of this assignment, which includes user I/O and file IVO / file processing b. Perform the following analysis: what is the order of magnitude to perform each operation. 1. Without using Java Collections/Containers, write a program that reads/stores integers into a linked list, storing them in the order read/inserted. Add an integer in the list only if it isn't in the list. In addition, create a method to delete a value (node) from the list; if the value is not in the list, print out an error message stating that it was not found and continue processing. Finally, terminate insertions into the list when the sentinel -9999 is encountered and display the contents of the list. In your sample run, be sure to demonstrate insertion, deletion, and displaying the contents of the list. 2. Design and implement a program using a linked list class from/using the Java Collections/Containers to create, manage, and retrieve information on a self-reorganizing list of names and telephone numbers When a node is created its ct is set to zero and it is placed at the first of the list. Every time a node is referenced, its ct is increased by 1 and when ct reaches 3 (a magic number?) the node should be deleted from its current place on the list, replaced at the head of the list, and its ct reset to 0 The program should recognize three commands, requested by the prompt CMD A Add a phone number. The program prompts for a name, and a telephone number Look up a number. The program prompts the user to input a name Change a phone number. The program prompts with name and a new phone number, printing an error message if the name does not exist in the list. Save the list to a file, as described below QQuit without saving, reverts back to the last saved version xit; save the list and exit the program The program should initialize itself from a text file of names and phone numbers (which contains a list of names and phone numbers that may initially be empty). When the command S is entered, the program should rewrite the file with the current form of the list. Additional Requirements a. Do not use the Scanner class for any part of this assignment, which includes user I/O and file IVO / file processing b. Perform the following analysis: what is the order of magnitude to perform each operationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started