Earn Higher Grades With Instant Assignment Help.Ask Question!

C++ Programming
(5/5)

Write functionality for a linked list of strings the program consists of 3 parts a linked list of strings part of which you need to implement newTests.cpp and newTests.h files

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Problem description

Problem: Write functionality for a linked list of strings.

The program consists of 3 parts: a linked list of strings part of which you need to implement, newTests.cpp and newTests.h files where you should put tests implemented by you and driver.cpp file that contains my tests and where all the tests are run.  When you run the program it runs the main function inside driver.cpp file. The main function runs a lot of small functions that test different linked list methods, one method at a time. These functions return false if the linked list method had an incorrect behavior. I provide a lot of these functions (called tests) to you.  Use them to test your program.  In addition, you’ll need to write 2 tests per function implemented.

Your program will contain:

One class, StringList. A linked list data structure that stores strings. As every class it is split into .h and .cpp files. .h file is provided to you and you shouldn’t change it (only uncomment functions that you’ve implemented). You’ll have to write a .cpp file.

Driver.cpp file that tests your program. It’s already given to you, you don’t need to implement anything there. (but you’ll need to uncomment parts of the code as you progress with an assignment).

newTests.cpp and newTests.h. You should not change the newTests.h file in any way. You need to write the newTests.cpp file.

  • h file that contains string node structure definition. Your program should consist of the following files:

StringList.h

StringList.cpp driver.cpp newTests.h newTests.cpp StringNode.h

But you’ll need to submit only StringList.cpp and newTests.cpp files because you shouldn’t change any other files (except for uncom- menting the code I’ve provided). All other files will be disregarded.

Functions to implement

For more details about the behaviour of the functions see tests I’ve provided to you.

Copy constructor As every copy constructor initializes this object with other object. In the end, this-¿head should point to a list with different nodes that contain the same data.

Destructor Should delete all nodes in the linked list.

concatenate Should concatenate all the strings in the list ”joined” by a string provided as the parameter.

toString Should return a string that when you would print it, con- tains one string (from the linked list) per line. Hint: use concatenate function.

pushFront Should put a given string to the beginning of the linked list.

popFront Should remove a string from the beginning of the linked list. Does nothing if linked list is empty.

front Should return a first value (string) in the linked list. Re- turns an empty string when the linked list is empty.

operator+ Given other linked list it should create a new linked list that contains elements of both this linked list and other linked list. Elements from this linked list go first.

reverse Should reverse an order of the nodes in the linked list.

insert Given a string and a position it inserts a string to the position with this index. Note, that, technically, we don’t have indexing in the linked list, but we can reason about the position using an index. Returns true if insert was successful. False if it’s impossible to insert an element into this position. For example, list contains 3 nodes it’s

impossible to insert an element to the position with an index 4. But we can do it for 3, effectively the same as pushBack. 0, 1 and 2 are valid positions to insert as well.

remove Given a string and a position it removes a node with a given index from the list. Returns true if remove was successful. False if element with a given position doesn’t exist. For example, for a list that contains 3 elements, positions 0, 1 and 2 will be valid when any higher value will not be valid.

 

Tests

You’re provided with tests that your program should pass. But you need to write tests of your own. To do that, edit newTests.cpp file and implement functions declared at newTests.h file. Try to mimic tests implemented by me. But make them different at the same time. For example, if your function implementation has some if statements and none of my tests go inside this if statement, write a test that tests the code inside this if statement.

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
594 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
734 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
767 Answers Hire Me