Explore BrainMass

Explore BrainMass

    List Program C++ with multiple operations

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    You are to implement a 'List' class to handle a list with general operations. That means you can insert and delete any element anywhere in the list. The list has no order, except for the order you insert or delete. The methods you are to implement are as given:

    Constructor methods (two, default and copy constructor, a list to a newly defined list, i.e. 'List listA(listB)'):

    Empty returns true or false if list is empty or not.
    Front makes current position at the beginning of the list.
    End makes current position at the end of a list.
    Previous places current position at the previous element in the list.
    Next places current position at the next element in the list.
    Get position returns current position or where you are in the list.
    Set position (int) places current position in a certain position in the list.
    Insert before inserts as a new element before the current position.
    Insert after inserts as a new element after the current position.
    Get element returns the one element that current position is pointing to.
    Size returns the size of the list (number of elements in list).
    Replace (int) replace the current element with a new value.
    Erase deletes the current element.
    Clear makes the list an empty list.
    Reverse reverses elements in a list.
    Swap swaps all the elemments of one list with the another list.

    Overload the operators: (at least) << output, == , + , = (assignment)

    You are to implement the List class using an array. For now the array can be 20 in size.
    You will need to use the 'ElementType' for 'typing' your data.
    You will need to use CAPACITY constant for the size of the array, in case we need to change the array size.
    When adding two lists make sure its within capacity, otherwise ignore it.
    When printing out the array across the screen horizontally, print only values that have been inserted, not all zeros.

    Please see the attachement as well.

    © BrainMass Inc. brainmass.com September 27, 2022, 3:58 pm ad1c9bdddf


    Solution Summary

    The solution contains an List.h with C++ list implementation and a ListMain.cpp testing program that calls list methods. The list requested is implemented using an array.