Question

/* * Purpose: Test an implementation of an array-based list ADT. * To demonstrate the use...

/*
* Purpose: Test an implementation of an array-based list ADT.
* To demonstrate the use of "ListArrayBased" the project driver
* class will populate the list, then invoke various operations
* of "ListArrayBased".
*/
import java.util.Scanner;

public class ListDriver {

   /*
   * main
   *
   * An array based list is populated with data that is stored
   * in a string array. User input is retrieved from that std in.
   * A text based menu is displayed that contains a number of options.
   * The user is prompted to choose one of the available options:
   * (1) Build List, (2) Add item, (3) Remove item, (4) Remove all items,
   * or (5) done. The switch statement manages calling the
   * appropriate method based on the option chosen by the user, and
   * prompts the user for further input as required Program terminates
   * if user chooses option (5). If the user chooses an option that is
   * not in the menu, a message telling the user to choose an appropriate
   * option is written to std out, followed by the options menu.
   */
   public static void main(String[] args)
   {
       String[] dataItems = {"milk","eggs","butter","apples","bread","chicken"};

       // TO DO: add code here
              
   } // end of main method
  
   /*
   * Displays the options menu, including the prompt
   * for the user
   */
   public void displayMenu()
   {
       // TODO: add code here
   }
  
   /*
   * displayStatus
   *
   * displays information about the state of
   * the list
   *
   * Preconditions: a reference to a list
   *
   * Postconditions:
   * "List empty: B" where B is either TRUE or FALSE
   * and "Size of list: n" where n is the size of
   * the list is written to std out.
   */
   public void displayStatus(ListArrayBased list)
   {
       // TO DO: add code here
   }
  
   /*
   * displayList
   *
   * Precondition: a reference to a list
   *
   * Postcondition: list is displayed on std out
   */
   public void displayList(ListArrayBased list)
   {
       // TO DO: add code here
   }
  
   /*
   * buildList
   *
   * Precondition: a reference to a list and an string array
   * of items to be address to the list
   *
   * Postcondition: items stored the string array are added
   * to the list.
   */
   public void buildList(ListArrayBased list, String[] items)
   {
       // TO DO: add code here
   }

   /*
   * addItem
   *
   * Precondition: a reference to a list, a String
   * representing a grocery item, and the integer
   * pos is the position in the list
   *
   * Postcondition: an item is added to the list at
   * position pos.
   */
   public void addItem(ListArrayBased list, String item, int pos)
   {          
       // TO DO: add code here      
   }
  
   /*
   * removeItem
   *
   * Precondition: a reference to a list and
   * int pos;
   *
   * Postcondition: item is removed from the list by its
   * position pos.
   */
   public void removeItem(ListArrayBased list, int pos)
   {      
       // TO DO: add code here      
   }
  
   /*
   * removeAllItems
   *
   * Precondition: a reference to a list
   *
   * Postcondition: all items currently stored in the list
   * are removed
   */
   public void removeAllItems(ListArrayBased list)
   {
       // TO DO: add code here
   }
      
} // end of class ListArrayBasedDriver

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
/* * Purpose: Test an implementation of an array-based list ADT. * To demonstrate the use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Complete an Array-Based implementation of the ADT List including a main method and show that the...

    Complete an Array-Based implementation of the ADT List including a main method and show that the ADT List works. Draw a class diagram of the ADT List __________________________________________ public interface IntegerListInterface{ public boolean isEmpty(); //Determines whether a list is empty. //Precondition: None. //Postcondition: Returns true if the list is empty, //otherwise returns false. //Throws: None. public int size(); // Determines the length of a list. // Precondition: None. // Postcondition: Returns the number of items in this IntegerList. //Throws: None....

  • Assignment #2: List - Array Implementation Review pages 6-7 in "From Java to C++" notes. Due...

    Assignment #2: List - Array Implementation Review pages 6-7 in "From Java to C++" notes. Due Friday, February 9th, 2017 @ 11:59PM EST Directions Create a List object. Using the following definition (List.h file is also in the repository for your convenience) for a list, implement the member functions (methods) for the List class and store the implementation in a file called List.cpp. Use an array to implement the list. Write the client code (the main method and other non-class...

  • +array:int[] This is provided to facilitate testing and grading. Use it as your internal array. +size:int...

    +array:int[] This is provided to facilitate testing and grading. Use it as your internal array. +size:int i.e. after items are added to the array, or deleted from it. One default constructor (receives nothing and initializes an array of size 0), and another constructor that receives an int[] and initializes the internal array with the input parameter. both of the constructors exist and work fine. In initializing the internal array with the input parameter, you should make a copy of the...

  • Chapter 4 describes the ADT Sorted List using an array implementation with a maximum of 25...

    Chapter 4 describes the ADT Sorted List using an array implementation with a maximum of 25 items. The pseudocode for the ADT Sorted List Operations are provided on page 210. Use this information to create an ADT for handling a collection of Person objects, where each object will contain a Social Insurance Number (validate this), a first name, a last name, a gender and a data of birth. This implementation should prevent duplicate entries – that is, the Social Insurance...

  • 1. Here are codes to define a stack class based on dynamic array, please complete the...

    1. Here are codes to define a stack class based on dynamic array, please complete the copy constructor //--- Definition of Stack copy constructor Stack::Stack(const Stack & original) : myCapacity(original.myCapacity), myTop(original.myTop) { //--- Get new array for copy myArray = new(nothrow) StackElement[myCapacity]; if (myArray != 0) // check if memory available                         // copy original's array member into this new array {              // Please complete the function here        } else {          cerr << "*Inadequate memory to allocate...

  • The purpose of this program is to help reinforce container class concepts and linked list concepts...

    The purpose of this program is to help reinforce container class concepts and linked list concepts in C++. Specifically, the task is to implement the sequence class using a linked list. You need to use the author's file sequence3.h to create your implementation file named sequence3.cpp. Please make your code as efficient and reusable as possible. Please make sure code can pass any tests. sequence3.h // FILE: sequence3.h // CLASS PROVIDED: sequence (part of the namespace main_savitch_5) // This is...

  • Instructions We're going to create a program which will allow the user to add values to a list, p...

    Instructions We're going to create a program which will allow the user to add values to a list, print the values, and print the sum of all the values. Part of this program will be a simple user interface. 1. In the Program class, add a static list of doubles: private statie List<double> _values new List<double>) this is the list of doubles well be working with in the program. 2. Add ReadInteger (string prompt) , and ReadDouble(string prompt) to the...

  • Write a menu driven program to demonstrate the use of array and switch. It must be...

    Write a menu driven program to demonstrate the use of array and switch. It must be written in C language . Here is the menu - Press 1 to add a number to the array. Press 2 to display the numbers entered in the array so far Press 3 to find the average of the numbers entered. Press 4 to exit. Option 1 - The user should be able to enter 20 numbers only. If all twenty numbers are entered...

  • The purpose of this lab is to help reinforce container class concepts and linked list concepts...

    The purpose of this lab is to help reinforce container class concepts and linked list concepts in C++. Specifically, the lab to repeat the sequence lab from last week except to use a linked list. You need to use the author's files sequence3.h and sequence_exam3.cpp. Author - Michael Main, Book - Data Structures and other objects using c++, 4th edition // FILE: sequence3.h // CLASS PROVIDED: sequence (part of the namespace main_savitch_5) // This is the header file for the...

  • Write a simple todo list application. This will require use of classes, objects, and possibly structs....

    Write a simple todo list application. This will require use of classes, objects, and possibly structs. Here are the requirements: 1. Menu-driven - upon running the program, the user should be prompted to press one of the following: 1. View all Todos in list 2. Remove a todo item from the list * if there are not any todos, the user should be prompted and sent back to the menu * choose a todo from list based on title to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT