Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please and thank you! You are to implement a 'List' class to handle a list with general operations. That means you can insert and

C++ please and thank you!

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. Your general list will store X Y coordinates, 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:

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

empty returns true or false if list is empty or not.

first makes current position at the beginning of the list

last makes current position at the end of a list.

prev places current position at the previous element in the list

next places 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 Element returns the one element that current position is pointing to

get Y 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,int) replace the current element with a new value X Y value

erase deletes the current element

clear makes the list an empty list

overload the 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions