Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help me with this C++ assignment? I'm really struggling with it. I would greatly appreciate it. It deals with a general list

Can someone please help me with this C++ assignment? I'm really struggling with it. I would greatly appreciate it. It deals with a general list class as stated in the algorithm with x y coordinates. Basically just set up the class and then write a main program to implement it. Thank you for your time, I really need help. It's basically a bag class (container class) being used in this program) It is as follows:

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

3. You can gain power by making others feel important.

Answered: 1 week ago