Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that our T/A is creating a video game In this game there are many targets that need to be displayed on the screen, and

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Suppose that our T/A is creating a video game In this game there are many "targets that need to be displayed on the screen, and modern graphics engines need to know the distance from the viewer to quickly process the scene. So, for this project you will implement a class to help the T/A keep track of an ordered list of the targets in increasing distance from the viewer. The class will be called zDepthList. The public methods of your class should be the following: Default constructor, creates an empty zDepthList DepthList() DepthList(int0, int) Constructor where the first parameter is an array and the second parameter is the length of the array. Should create a zDepthList containing all the items in the array. The items in the array are given in increasing distance to the source. The entry in the array is the index of that item in the zDepthList. void out (const char) output method. Traverses the zDepthList in order of depth. The parameter indicates the direction. The default is "f indicating close to far, or forward. If the parameter is 'r, then the traversal should be far to near, or reverse. void move (int, int, char) This method reorders thezDepthList. The first parameter is the index of the item to be moved. The second parameter is the number of steps, and the last parameter is the direction, where 'f is the default and means to move the item "deeper" in the list and 'r means to move the item closer in the list. void movefront (int) Moves the item at the given index to the front of the DepthList void moveback(int) Moves the item at the given index to the back of the Depth List int at (int) returns the index ofthe item at position l in the zDepthList starting at 0 for the front of the list Challenge for the bored/extra credit. Implement your int addback() int addfront() zDepthList using your MyDynamicArray class, so that you can add items to the zDepthList. When adding items, the new item goes at the next index and either at the back or front of the depth list depending on the method. Returns the index of the new item The data structures that you should use to implement your zDepthList are an array and a doubly linked list. The array will hold the items by their index, and should store a

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