33.3k views
4 votes
Write a program that accepts commands to carry out some operations to mar of names. Runn the program will show the user a menu. Blue: Terminal Window-Exam Array list Options Description of operations - some with example A - A Oliver (Add Oliver) O - Ordered list U - Unordered list D - D (Delete 1st item) Q - Quit H - See this menu for help Enter an operation. Type input and press Enter to send to program In the following screen shot, the texts displayed by the program are in black. The command by you are in blue. After the commands of "A Oliver", "A Jimmy", Tom", three names are added to the Array List. After the O command, the Array List is sorted. Future U command will produce ordered Array unless we add a new name making the current Array List out of order again. "D 11" deletes the 1st item in the Array List.

1 Answer

2 votes

Final answer:

The question asks for a program that manages a list of names with options to add, sort, display, delete, and exit. It involves coding array list manipulations and interpreting user input in a command-line interface.

Step-by-step explanation:

The question requires writing a program that handles an array list of names with various operations. The program should show a menu to the user and respond to inputs such as adding a name, showing the list in either ordered or unordered form, deleting an item, and quitting the program. While the specific programming language is not mentioned, the operations described are common to many languages that support array or list data structures.

Example Operations

  • Add a name: Inserts a new name into the array list.
  • Ordered list: Sorts the array list in some defined order.
  • Unordered list: Displays the list in its current state, which may be unsorted if a new name has been added after sorting.
  • Delete the first item: Removes the first item from the array list.
  • Quit: Exits the program.
  • Help: Shows the menu for assistance.

The use of a command-line interface is implied, where the user will input commands in blue text after the prompt.

User Psar Tak
by
8.2k points