Details of this Paper

C++ Lab Assignment (Data abstraction)

Description

solution


Question

Laboratory 04: Circularly Linked List;Download the following files;Lab04Files.zip //provided, completed files;CLGUI.h;CLGUI.cpp;CircularList.h;CircularListIterator.h;Circular List Navigation;The main reason to use a circularly (doubly) linked list is the fact that it is fast to move from the end of the list to the beginning of the list in either direction. However, to use this speed, you must first determine the number of steps to get to the destination index using next links vs. using prev links. Complete the find(int index) method in CircularList.h to make this determination.;Circular List Removal;Complete the remove(int index) method in CircularList.h. To get to the requested index, call the find method. Removing the last item in the list is a special case. Set loc_pos to the removal location (set loc_pos to 0 if the last item is removed). Remember to delete nodes as appropriate, but not data.;The below class interfaces are defined in the namespace CSC2110.;String methods;String(const char* text) //constructor;void displayString();int length();const char* getText();int a_to_i();float a_to_f();String* i_to_a(int number) //static method;String* f_to_a(float number) //static method;int find(char delimiter, int start) //find the index of a particular character;String* substr(int start, int end);int compare(String* other);char charAt(int index) //0-based;Tokens methods;Tokens(String* str, char delimiter) //destructor does not delete the individual tokens;String* getToken(int index);int getNumTokens();void displayTokens();ReadFile methods;ReadFile(const char* file_name);String* readLine();bool eof();void close();WriteFile methods;WriteLine(String* file_name);void writeLine(String* line);void close();Random methods (use getRandom first);static Random* getRandom();int getRandomInt(int lower, int upper);float getRandomFloat(float lower, float upper);Keyboard methods (use getKeyboard first);static Keyboard* getKeyboard() //call this first;int readInt(string prompt);int getValidatedInt(string prompt, int min, int max);double readDouble(string prompt);double getValidatedDouble(string prompt, double min, double max);String* readString(string prompt);Integer/Double methods;Integer(int val)/Double(double val);int getValue()/double getValue();CD methods;CD(String* artist, String* title, int year, int rating, int num_tracks);void displayCD() //display the current state of the CD;String* getKey();void addSong(String* title, String* length);static int compare_items(CD* one, CD* two) //define how to compare CDs (in this case, by title);static int compare_keys(String* sk, CD* cd);static ListArray* readCDs(const char* file_name) //read in all of the CDs from a text file;Song methods;Song(String* title, String* length);void displaySong()

 

Paper#65969 | Written in 18-Jul-2015

Price : $52
SiteLock