Question: i need help making this in c++ the skeleton oh the program is below: sentence.h: #include #include using namespace std; #ifndef SENTENCE_H #define SENTENCE_H class

i need help making this in c++
the skeleton oh the program is below:
sentence.h:
#include
#include
using namespace std;
#ifndef SENTENCE_H
#define SENTENCE_H
class word
{
public:
string term;
word* next;
};
class sentence
{
public:
//sentence(); //The default constructor will initialize your state variables.
// //The front of the linked list is initially set to NULL or 0; this implies a non-header node
// //implementation of the link list.
//sentence(const string& s); //Explicit-value constructor: This constructor will have one argument;
// //a C-style string or a C++ string representing the word to be created;
//sentence(const sentence& org); // Copy Constructor: Used during a call by value, return, or initialization/declaration of a word object;
//~sentence(); //Destructor: The destructor will de-allocate all memory allocated for the word. Put the message
// //"destructor called " inside the body of the destructor.
//bool isEmpty() { return front == 0; } //inline implementation
//int length(); //Length: Determines the length of the word A; remember A is the current object;
//void add_back(string& s);
//friend ostream& operator
//void operator=(const string& s);// Overload the assignment operator as a member function to take a
// //string (C-style or C++ string, just be consistent in your implementation) as an argument and
// //assigns its value to A, the current object;
//sentence& operator=(const sentence& w) { sentence k; return k; } // Overload the assignment operator as a member function with chaining to take a word
// //object as an argument and assigns its value to A, the current object;
//void operator+(sentence& B); //Overload the + operator as a member function without chaining to add word B
// //(adds the set of symbols that makep B's linked list to the back of A's linked list) to the back of word A;
// //remember A is the current object;
//bool isEqual(sentence& B); // Returns true if two word objects are equal; otherwise false; remember A is the current
//void remove(const string& s); //Deletes the first occurrence of the string s from the list A;
private:
word* front, * back;
};
#endif
sentence_driver.cpp
//Remember to put your program header in this file;
//Remember to include function name, pre/post conditions, and descriptions in all function headers;
//Remember to comment code if necessary to understand.
#include
#include
#include "sentence.h"
using namespace std;
int main()
{
//cout
//sentence you;
//cout
//cout
//cout
//cout
//sentence me("Today is a wonderful day! ");//sentence with 3 spaces at end
//cout
//cout
//sentence me_to("");
//cout
//cout
//sentence you_to(" ");
//cout
//cout
//cout
//cout
//cout
//sentence them = me;
//cout
//cout
//
//cout
//cout
//cout
//cout
//sentence us;
//us = "There are five racoons in the palm tree.";
//cout
// "\""
//cout
//cout
//cout
//cout
//sentence her, him;
//her = "I am very happy";
//him = "They are very happy";
//cout
//
//her = "";
//him = "";
//cout
//her = " ";
//him = " ";
//cout
//her = "";
//him = " ";
//cout
//her = " ";
//him = " ";
//cout
//her = " ";
//him = " ";
//cout
//cout
//cout
//cout
//cout
//sentence their("Everything ");
//us = "will be okay.";
//cout
//cout
//their + us;
//cout
//cout
//cout
//us + their;
//cout
//cout
//cout
//us = "123 456";
//their = "123";
//cout
//cout
//us + their;
//cout
//us = "123 456";
//their = "";
//cout
//cout
//their + us;
//cout
//cout
//cout
//them = "";
//them.remove("123");
//cout
//them = "123";
//them.remove("123");
//cout
//them = "123 abc 124 abc 123 4567";
//them.remove("123");
//cout
//them = "123 abc 124 abc 123 4567";
//them.remove("4567");
//cout
//them = "123 abc 124 abc 123 4567";
//them.remove("124");
//cout
//them.remove(" ");
//cout
//them.remove(" ");
//cout
//them.remove(" ");
//cout
//them.remove(" ");
//cout
//them.remove(" ");
//cout
//cout
//cout
//cout
//sentence h("123 456 780");
//them = h;
//cout
//cout
//cout
//cout
return 0;
}
i need help making this in c++ the skeleton oh the program
is below: sentence.h: #include #include using namespace std; #ifndef SENTENCE_H #define SENTENCE_H
class word { public: string term; word* next; }; class sentence {
Objectives: This assignment will access your CH+ language skills and understanding of linked lists. After completing this assignment you will be able to do the following: (1) Manage a singly-linked list with pointers to the front and back of the singly-linked list, (2) allocate memory dynamically (3) implement a default, explicit-value and copy constructors, (4) a destructor, (5) add a node to a singly-linked list, and (6) delete a node anywhere in a singly-linked list. In this assignment you will implement the SENTENCE ADT (abstract data type) using a singly- linked list of strings. The SENTENCE ADT is defined below. Call the class you implement "sentence". Remember, a singly-linked list is composed of nodes. You will also implement a class called "word" that has two fields: a string field called "term"; and a pointer field called "next". Essentially, each word is really a node in the linked list. And sentence is the singly-linked list. Each node (word) in the linked list (sentence) will contain one string of a sentence. Note that a space is considered a string. Consider the following declaration of a word. A "sentence is composed of words: class word { public: string term; word *next; The state (private data members) of your "sentence" class should contain a pointer to the front of the list of words called "front" and a pointer to the back of the list called "back". You may add more members to the state and more member functions to the behavior of the class if you determine necessary. Store the definition of your class in a file called "sentence.cpp" and the declaration of your class in a file called "sentence.h." You will implement all the code necessary to maintain a sentence. See the ADT below. Test the complete functionality of the class "sentence". You must use the file "sentence_driver.cpp" to help you understand and test all the required functionality of the class. If you discover that you need more tests while implementing the functionality of the sentence class, then add more tests to your driver, but your final code must be submitted with the given driver. ADT ---sentence Data: A set of terms Operations: 1. Default constructor: The default constructor will initialize your state variables. The front and back of the linked list is initially set to NULL or 0; this implies a non-header node implementation of the link list. 2. Explicit-value constructor: This constructor will have one argument; a C-style string or a CH+ string representing the sentence to be created; 3. Copy Constructor: Used during a call-by-value, return, or initialization/declaration of a sentence object; 4. Destructor: The destructor will de-allocate all memory allocated for the sentence. Put the message "destructor called n" inside the body of the destructor. 5. isEmpty: Check to see if the sentence A is empty: A is the current object; Note if either front = 0 or back=0 then the list is empty. 6. length: Determines the length of the sentence A; remember A is the current object and space should be counted in the length of the sentence; 7. add_back: Add a word (node) to the back of the sentence (link list). Note that if the list contains only one node then front and back will point to the same node. 8. operator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!