Question: c++ program You are to implement a 'List' class to handle a list with general operations. That means you can insert and delete any element

c++ program

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. Your list will be an array (one dimensional array). Your general list will store X Y coordinates (store x coordinate beside y coordinate - xyxyxyxyxyxyxyxyxyxyxyxyxy), i.e. pairs of numbers in the array. The list has no order, except for the order you insert or delete. The methods you are to implement are as given:

Constructormethods (two, default and copy constructor, a list to a newly defined list, ie 'List listA(listB)' )

emptyreturns true or false if list is empty or not.

firstmakes current position at the beginning of the list

lastmakes current position at the end of a list.

prevplaces current position at the previous element in the list

nextplaces current position at the next element in the list

getPos returns current position or where you are in the list

setPos(int)places current position in a certain position in the list

insertBefore(int,int) inserts a new element before the current position

insertAfter(int, int)inserts a new element after the current position

get X Elementreturns the one element that current position is pointing to

get Y Elementreturns the one element that current position is pointing to

sizereturns the size of the list (number of elements in list)

replace(int,int)replace the current element with a new value X Y value

erasedeletes the current element

clearmakes the list an empty list

overloadthe operators: (at least) << output, ==, !=, +,+=, { =(assignment) maybe? }

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.

Invariants: The elements in the list are to be left justified with in the array. pos will point to a valid location in the array (ie where data is located. On insert, pos should point to the element just inserted on insert operations. pos should never be outside of element list.

I will supply you a main program to test your code with. I will supply you a main program at a later time. Do not wait for my code to test your program, but test your code with your own main program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!